ListFlavors() public méthode

public ListFlavors ( int minDiskInGB = null, int minRamInMB = null, string markerId = null, int limit = null ) : IEnumerable
minDiskInGB int
minRamInMB int
markerId string
limit int
Résultat IEnumerable
        public void ListFlavorsDetailsTest()
        {
            foreach (var m in TestEnvMembers.Members)
            {
                var os = new OpenStackMember(m.UserName, m.Password, m.TenantName); // without tenant, can not get endpoints.
                IEnumerable<Flavor> flavors = null;
                try
                {
                    flavors = os.ListFlavors();
                }
                catch (net.openstack.Core.Exceptions.UserAuthorizationException uae)
                {
                    Assert.IsTrue(uae.Message.Equals("The user does not have access to the requested service or region."));
                    return;
                }

                os = new OpenStackMember(m.UserName, m.Password, m.TenantName); // with tenant
                flavors = os.ListFlavorsDetails();
                Assert.IsNotNull(flavors);
                foreach (var f in flavors)
                {
                    Assert.IsNotNull(f.Id);
                    Assert.IsNotNull(f.Name);
                    Assert.IsNotNull(f.Links);
                }
            }
        }
        public void RevertResizeServerTest()
        {
            var osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.ShutOff);
            if (ss != null)
            {
                Server s = osm.GetServer(ss.Id);
                //if (s.Status.Name != "SHUTOFF")
                //    os.StopServer(s.Id);

                if (s.Status != ServerState.VerifyResize)
                {
                    IEnumerable<Flavor> flavors = osm.ListFlavors();
                    Flavor flavor1g = flavors.Where<Flavor>(x => x.Name == "g-1gb").First<Flavor>();
                    Flavor flavor2g = flavors.Where<Flavor>(x => x.Name == "g-2gb").First<Flavor>();
                    osm.ResizeServer(s.Id, (s.Flavor.Id == flavor1g.Id ? flavor2g.Id : flavor1g.Id), DiskConfiguration.FromName("AUTO"));
                    Trace.WriteLine(String.Format("server requested a resizing : {0}", DateTime.Now));
                    Trace.WriteLine(String.Format("FlavorId : {0}", s.Flavor.Id));
                    // wait for request
                    s = osm.ServersProvider.WaitForServerState(s.Id, ServerState.VerifyResize, new[] { ServerState.Error, ServerState.Unknown, ServerState.Suspended });
                    Trace.WriteLine(String.Format("server status changed to {0} : {1}", s.Status, DateTime.Now));
                }

                // resize
                bool b = osm.RevertResizeServer(s.Id);
                Assert.IsTrue(b);
                Trace.WriteLine(String.Format("server reverted a resizing : {0}", DateTime.Now));

                // wait for activate
                s = osm.ServersProvider.WaitForServerActive(s.Id);
                Trace.WriteLine(String.Format("server activated : {0}", DateTime.Now));
            }
        }
        public void ResizeServerTest()
        {
            var osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.ShutOff);
            Server server = osm.GetServer(ss.Id);
            if (server != null)
            {

                if (server.Status == ServerState.VerifyResize)
                {
                    osm.RevertResizeServer(server.Id);
                    Trace.WriteLine(String.Format("server reverted a resizing : {0}", DateTime.Now));
                    // wait for activate
                    server = osm.ServersProvider.WaitForServerActive(server.Id);
                    Trace.WriteLine(String.Format("server activated : {0}", DateTime.Now));
                }
                IEnumerable<Flavor> flavors = osm.ListFlavors();
                Flavor flavor1g = flavors.Where<Flavor>(x => x.Name == "g-1gb").First<Flavor>();
                Flavor flavor2g = flavors.Where<Flavor>(x => x.Name == "g-2gb").First<Flavor>();
                bool b;
                try
                {
                    b = osm.ResizeServer(server.Id, (server.Flavor.Id == flavor1g.Id ? flavor2g.Id : flavor1g.Id), DiskConfiguration.FromName("AUTO"));
                    Assert.IsTrue(b);

                    Trace.WriteLine(String.Format("server requested a resizing : {0}", DateTime.Now));
                    Trace.WriteLine(String.Format("FlavorId : {0}", server.Flavor.Id));

                    // wait for request
                    server = osm.ServersProvider.WaitForServerState(server.Id, ServerState.VerifyResize, new[] { ServerState.Error, ServerState.Unknown, ServerState.Suspended });
                    Trace.WriteLine(String.Format("server status changed to {0} : {1}", server.Status, DateTime.Now));

                }
                catch (ServiceConflictException sce)
                {
                    // throwing ServiceConflictException when server is locked is designed.
                    Assert.IsTrue(sce.Message.Contains("locked"));
                }
            }
        }