本文整理汇总了Python中tempest.common.waiters.wait_for_server_termination函数的典型用法代码示例。如果您正苦于以下问题:Python wait_for_server_termination函数的具体用法?Python wait_for_server_termination怎么用?Python wait_for_server_termination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wait_for_server_termination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_router_interfaces
def delete_router_interfaces(cmgr, router, and_attached_resources=False):
if type(router) is not dict:
router = cmgr.qsvc('router-show', router)
ports = cmgr.qsvc('router-port-list', router['id'])
for port in ports:
if port['device_owner'].find(':router_interface') > 0:
if 'fixed_ips' in port:
for fixed_ips in port['fixed_ips']:
if 'subnet_id' in fixed_ips:
sv_port_list = cmgr.qsvc(
"port-list",
network_id=port['network_id'],
device_owner="compute:None")
for sv_port in sv_port_list:
try:
sv = cmgr.nova("server-show",
sv_port['device_id'])
cmgr.nova("server-delete", sv['id'])
waiters.wait_for_server_termination(
cmgr.manager.servers_client,
sv['id'])
except:
pass
cmgr.qsvc('router-interface-delete',
router['id'], fixed_ips['subnet_id'])
示例2: delete_server
def delete_server(cls, server_id):
"""Deletes an existing server and waits for it to be gone."""
try:
cls.servers_client.delete_server(server_id)
waiters.wait_for_server_termination(cls.servers_client, server_id)
except Exception:
LOG.exception("Failed to delete server %s" % server_id)
示例3: test_delete_server_while_in_suspended_state
def test_delete_server_while_in_suspended_state(self):
# Delete a server while it's VM state is Suspended
server = self.create_test_server(wait_until='ACTIVE')
self.client.suspend_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SUSPENDED')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
示例4: test_delete_server_while_in_shutoff_state
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
示例5: test_delete_server_while_in_pause_state
def test_delete_server_while_in_pause_state(self):
# Delete a server while it's VM state is Pause
server = self.create_test_server(wait_until='ACTIVE')
self.client.pause_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
示例6: tearDown
def tearDown(self):
if self.vip_fip:
LOG.debug("tearDown lbass vip fip")
self.disassociate_floatingip(self.vip_fip, and_delete=True)
if self.loadbalancer:
LOG.debug("tearDown lbass")
lb_id = self.loadbalancer['id']
self.delete_loadbalancer_resources(lb_id)
# make sure servers terminated before teardown network resources
LOG.debug("tearDown lbaas servers")
server_id_list = []
for servid in ['server1', 'server2']:
server = getattr(self, servid, None)
if server:
if '_floating_ip' in server:
fip = server['_floating_ip']
self.disassociate_floatingip(fip, and_delete=True)
self.manager.servers_client.delete_server(server['id'])
server_id_list.append(server['id'])
for server_id in server_id_list:
waiters.wait_for_server_termination(
self.manager.servers_client, server_id)
# delete lbaas network before handing back to framework
LOG.debug("tearDown lbaas network")
self.delete_wrapper(self.router.delete)
self.delete_wrapper(self.subnet.delete)
self.delete_wrapper(self.network.delete)
super(TestLBaasRoundRobinOps, self).tearDown()
LOG.debug("tearDown lbaas exiting...")
示例7: cleanup
def cleanup(self):
"""Cleanup the underlying instance.
In order for the back-end to be useful again,
call :meth:`setup_instance` method for preparing another
underlying instance.
"""
LOG.info("Cleaning up...")
if self._security_groups_rules:
for rule in self._security_groups_rules:
(self._manager.security_group_rules_client.
delete_security_group_rule(rule))
if self._security_group:
self._manager.servers_client.remove_security_group(
server_id=self.internal_instance_id(),
name=self._security_group['name'])
if self._server:
self._manager.servers_client.delete_server(
self.internal_instance_id())
waiters.wait_for_server_termination(
self._manager.servers_client,
self.internal_instance_id())
if self._floating_ip:
self._manager.floating_ips_client.delete_floating_ip(
self._floating_ip['id'])
if self._keypair:
self._keypair.destroy()
self._manager.cleanup_credentials()
示例8: test_delete_server_while_in_shelved_state
def test_delete_server_while_in_shelved_state(self):
# Delete a server while it's VM state is Shelved
server = self.create_test_server(wait_until='ACTIVE')
compute.shelve_server(self.client, server['id'])
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
示例9: test_preserve_preexisting_port
def test_preserve_preexisting_port(self):
"""Tests that a pre-existing port provided on server boot is not
deleted if the server is deleted.
Nova should unbind the port from the instance on delete if the port was
not created by Nova as part of the boot request.
"""
# Setup the network, create a port and boot the server from that port.
self._setup_network_and_servers(boot_with_port=True)
_, server = self.floating_ip_tuple
self.assertEqual(1, len(self.ports),
'There should only be one port created for '
'server %s.' % server['id'])
port_id = self.ports[0]['port']
self.assertIsNotNone(port_id,
'Server should have been created from a '
'pre-existing port.')
# Assert the port is bound to the server.
port_list = self._list_ports(device_id=server['id'],
network_id=self.network['id'])
self.assertEqual(1, len(port_list),
'There should only be one port created for '
'server %s.' % server['id'])
self.assertEqual(port_id, port_list[0]['id'])
# Delete the server.
self.servers_client.delete_server(server['id'])
waiters.wait_for_server_termination(self.servers_client, server['id'])
# Assert the port still exists on the network but is unbound from
# the deleted server.
port = self.ports_client.show_port(port_id)['port']
self.assertEqual(self.network['id'], port['network_id'])
self.assertEqual('', port['device_id'])
self.assertEqual('', port['device_owner'])
示例10: resource_cleanup
def resource_cleanup(cls):
# Delete the test instance
cls.servers_client.delete_server(cls.server['id'])
waiters.wait_for_server_termination(cls.servers_client,
cls.server['id'])
super(VolumesV2ActionsTest, cls).resource_cleanup()
示例11: test_reboot_deleted_server
def test_reboot_deleted_server(self):
# Reboot a deleted server
server = self.create_test_server()
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
server['id'], type='SOFT')
示例12: test_delete_server_while_in_verify_resize_state
def test_delete_server_while_in_verify_resize_state(self):
# Delete a server while it's VM state is VERIFY_RESIZE
server = self.create_test_server(wait_until='ACTIVE')
self.client.resize_server(server['id'], self.flavor_ref_alt)
waiters.wait_for_server_status(self.client, server['id'],
'VERIFY_RESIZE')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
示例13: test_rebuild_deleted_server
def test_rebuild_deleted_server(self):
# Rebuild a deleted server
server = self.create_test_server()
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
self.assertRaises(lib_exc.NotFound,
self.client.rebuild_server,
server['id'], self.image_ref_alt)
示例14: resource_setup
def resource_setup(cls):
super(ServersNegativeTestJSON, cls).resource_setup()
server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
server = cls.create_test_server()
cls.client.delete_server(server['id'])
waiters.wait_for_server_termination(cls.client, server['id'])
cls.deleted_server_id = server['id']
示例15: test_get_list_deleted_instance_actions
def test_get_list_deleted_instance_actions(self):
# List actions of the deleted server
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
body = (self.client.list_instance_actions(server['id'])
['instanceActions'])
self.assertEqual(len(body), 2, str(body))
self.assertEqual(sorted([i['action'] for i in body]),
['create', 'delete'])