public void ConfirmServerResizedTest_Revert_Without_Resize() { 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 == ServerState.VerifyResize) { osm.RevertResizeServer(s.Id); 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)); } // expect ServiceConflictException bool b = osm.RevertResizeServer(s.Id); } }
public void ResizeServerTest_same_flavorid() { 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 == ServerState.VerifyResize) { osm.RevertResizeServer(s.Id); 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)); } // expect BadServiceRequestException bool b = osm.ResizeServer(s.Id, s.Flavor.Id, DiskConfiguration.FromName("AUTO")); Assert.IsTrue(b); } }
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")); } } }