当前位置: 首页>>代码示例>>Python>>正文


Python waiters.wait_for_server_termination方法代码示例

本文整理汇总了Python中tempest.common.waiters.wait_for_server_termination方法的典型用法代码示例。如果您正苦于以下问题:Python waiters.wait_for_server_termination方法的具体用法?Python waiters.wait_for_server_termination怎么用?Python waiters.wait_for_server_termination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tempest.common.waiters的用法示例。


在下文中一共展示了waiters.wait_for_server_termination方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
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 server_name in self.topology_servers.keys():
            fip = self.servers_details[server_name].floating_ips[0]
            self._disassociate_floating_ip(fip)
            server_id = self.servers_details[server_name].server['id']
            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
        super(LBaasRoundRobinBaseTest, self).tearDown()
        LOG.debug("tearDown lbaas exiting...") 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:26,代码来源:test_lbaas_scenario.py

示例2: clear_servers

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def clear_servers(cls):
        LOG.debug('Clearing servers: %s', ','.join(
            server['id'] for server in cls.servers))
        for server in cls.servers:
            try:
                test_utils.call_and_ignore_notfound_exc(
                    cls.servers_client.delete_server, server['id'])
            except Exception:
                LOG.exception('Deleting server %s failed' % server['id'])

        for server in cls.servers:
            try:
                waiters.wait_for_server_termination(cls.servers_client,
                                                    server['id'])
            except Exception:
                LOG.exception('Waiting for deletion of server %s failed'
                              % server['id']) 
开发者ID:redhat-openstack,项目名称:whitebox-tempest-plugin,代码行数:19,代码来源:base.py

示例3: _rebuild_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def _rebuild_server(self):
        server, flavor = self.create_test_server(wait_until='ACTIVE')
        image = self._prepare_image()

        self.os_primary.servers_client.rebuild_server(server['id'],
                                                      image['id'])
        waiters.wait_for_server_status(self.os_primary.servers_client,
                                       server['id'],
                                       status='ACTIVE')

        self.addCleanup(waiters.wait_for_server_termination,
                        self.os_primary.servers_client, server['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.os_primary.servers_client.delete_server,
                        server['id'])

        return server, flavor 
开发者ID:openstack,项目名称:almanach,代码行数:19,代码来源:test_server_rebuild.py

示例4: test_create_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def test_create_server(self):
        server, flavor = self.create_test_server(wait_until='ACTIVE')

        self.addCleanup(waiters.wait_for_server_termination,
                        self.os_primary.servers_client, server['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.os_primary.servers_client.delete_server,
                        server['id'])

        entities = self.get_tenant_entities(server['tenant_id'])

        self.assertEqual(1, len(entities))
        self.assertEqual(server['id'], entities[0]['entity_id'])
        self.assertEqual('instance', entities[0]['entity_type'])
        self.assertEqual(server['name'], entities[0]['name'])
        self.assertEqual(flavor['name'], entities[0]['flavor'])
        self.assertIsNotNone(entities[0]['start'])
        self.assertIsNone(entities[0]['end']) 
开发者ID:openstack,项目名称:almanach,代码行数:20,代码来源:test_server_creation.py

示例5: _resize_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def _resize_server(self):
        flavors = self.flavors_client.list_flavors()['flavors']
        resized_flavor = flavors[1]
        server, initial_flavor = self.create_test_server(wait_until='ACTIVE')
        self.os_primary.servers_client.resize_server(server['id'],
                                                     resized_flavor['id'])

        waiters.wait_for_server_status(self.os_primary.servers_client,
                                       server['id'],
                                       status='VERIFY_RESIZE')

        self.os_primary.servers_client.confirm_resize_server(server['id'])

        waiters.wait_for_server_status(self.os_primary.servers_client,
                                       server['id'],
                                       status='ACTIVE')

        self.addCleanup(waiters.wait_for_server_termination,
                        self.os_primary.servers_client, server['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.os_primary.servers_client.delete_server,
                        server['id'])

        return server, initial_flavor, resized_flavor 
开发者ID:openstack,项目名称:almanach,代码行数:26,代码来源:test_server_resize.py

示例6: tearDown

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
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', 'server7', 'server8']:
            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
        super(LBaasRoundRobinBaseTest, self).tearDown()
        LOG.debug("tearDown lbaas exiting...") 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:28,代码来源:test_lbaas_round_robin_ops.py

示例7: tearDown

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def tearDown(self):
        # delete all servers and make sure they are terminated
        servers_client = self.cmgr_adm.servers_client
        server_id_list = getattr(self, 'server_id_list', [])
        for server_id in server_id_list:
            servers_client.delete_server(server_id)
        for server_id in server_id_list:
            waiters.wait_for_server_termination(servers_client, server_id)
        # delete all floating-ips
        if hasattr(self, 'fip_nasa_ames_1'):
            self.delete_floatingip(self.cmgr_ames, self.fip_nasa_ames_1)
        if hasattr(self, 'fip_nasa_jpl_3'):
            self.delete_floatingip(self.cmgr_jpl, self.fip_nasa_jpl_3)
        super(TestAdminPolicyBasicOps, self).tearDown() 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:16,代码来源:test_admin_policy_basic_ops.py

示例8: test_create_server_attach_volume

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def test_create_server_attach_volume(self):
        # To create a bootable volume, the UUID of the image from which
        # to create the volume must be included as the imageRef attribute in
        # the request body.
        volume_id = self.create_volume(
            imageRef=CONF.compute.image_ref,
            size=CONF.volume.volume_size)['id']

        server_name = data_utils.rand_name(self.__class__.__name__ + "-server")
        bd_map_v2 = [{'uuid': volume_id,
                      'source_type': 'volume',
                      'destination_type': 'volume',
                      'boot_index': 0,
                      'delete_on_termination': True}]
        device_mapping = {'block_device_mapping_v2': bd_map_v2}

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        # Use image_id='' to avoid using the default image in tempest.conf.
        server = self.create_test_server(name=server_name, image_id='',
                                         **device_mapping)
        # Delete the server and wait for the volume to become available to
        # avoid clean up errors.
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        waiters.wait_for_volume_resource_status,
                        self.volumes_client, volume_id, 'available')
        self.addCleanup(waiters.wait_for_server_termination,
                        self.servers_client, server['id'])
        self.addCleanup(self.delete_server, server['id']) 
开发者ID:openstack,项目名称:patrole,代码行数:30,代码来源:test_server_rbac.py

示例9: test_create_server_attach_network

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def test_create_server_attach_network(self):
        def _create_network_resources():
            # Create network
            network_name = data_utils.rand_name(
                self.__class__.__name__ + '-network')

            network = self.networks_client.create_network(
                name=network_name, port_security_enabled=True)['network']
            self.addCleanup(self.networks_client.delete_network, network['id'])

            # Create subnet for the network
            subnet_name = data_utils.rand_name(
                self.__class__.__name__ + '-subnet')
            subnet = self.subnets_client.create_subnet(
                name=subnet_name,
                network_id=network['id'],
                cidr=CONF.network.project_network_cidr,
                ip_version=4)['subnet']
            self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])

            return network

        network = _create_network_resources()
        network_id = {'uuid': network['id']}

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        server = self.create_test_server(wait_until='ACTIVE',
                                         networks=[network_id])
        self.addCleanup(waiters.wait_for_server_termination,
                        self.servers_client, server['id'])
        self.addCleanup(self.servers_client.delete_server, server['id']) 
开发者ID:openstack,项目名称:patrole,代码行数:33,代码来源:test_server_rbac.py

示例10: test_delete_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def test_delete_server(self):
        server = self.create_test_server(wait_until='ACTIVE')

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        self.servers_client.delete_server(server['id'])
        waiters.wait_for_server_termination(
            self.admin_servers_client, server['id']) 
开发者ID:openstack,项目名称:patrole,代码行数:9,代码来源:test_server_rbac.py

示例11: _create_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def _create_server(self, flavor=None):
        """Wrapper utility that returns a test server.

        This wrapper utility calls the common create test server and
        returns a test server.
        """
        clients = self.os_primary
        name = data_utils.rand_name(self.__class__.__name__ + "-server")
        image_id = self._get_image_ref()
        flavor = flavor or self._get_flavor_ref()
        keypair = self.create_keypair()
        tenant_network = self.get_tenant_network()
        security_group = self._create_security_group()
        # we need to pass the security group's name to the instance.
        sg_group_names = [{'name': security_group['name']}]

        body, _ = compute.create_test_server(
            clients, name=name,
            flavor=flavor,
            image_id=image_id,
            key_name=keypair['name'],
            tenant_network=tenant_network,
            security_groups=sg_group_names,
            wait_until='ACTIVE')

        self.addCleanup(waiters.wait_for_server_termination,
                        self.servers_client, body['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.servers_client.delete_server, body['id'])
        server = clients.servers_client.show_server(body['id'])['server']

        floating_ip = self.create_floating_ip(server)
        server_tuple = Server_tuple(
            server=server,
            keypair=keypair,
            floating_ip=floating_ip,
            security_groups=[security_group])

        return server_tuple 
开发者ID:openstack,项目名称:oswin-tempest-plugin,代码行数:41,代码来源:test_base.py

示例12: tearDown

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def tearDown(self):
        super(TestVolumeAttachmentScenario, self).tearDown()
        self.addCleanup(waiters.wait_for_server_termination,
                        self.os_primary.servers_client, self._server['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.os_primary.servers_client.delete_server,
                        self._server['id'])
        self.addCleanup(self.volumes_client.wait_for_resource_deletion,
                        self._volume['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.volumes_client.delete_volume, self._volume['id']) 
开发者ID:openstack,项目名称:almanach,代码行数:13,代码来源:test_volume_attachment.py

示例13: delete_test_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def delete_test_server(self, server):
        self.os_primary.servers_client.delete_server(server['id'])
        waiters.wait_for_server_termination(self.os_primary.servers_client,
                                            server['id'], True) 
开发者ID:openstack,项目名称:almanach,代码行数:6,代码来源:base.py

示例14: create_server

# 需要导入模块: from tempest.common import waiters [as 别名]
# 或者: from tempest.common.waiters import wait_for_server_termination [as 别名]
def create_server(self, name=None, image=None, flavor=None,
                      wait_on_boot=True, wait_on_delete=True,
                      servers_client=None, tenant_id=None,
                      create_kwargs=None):
        """Creates VM instance.

        @param image: image from which to create the instance
        @param wait_on_boot: wait for status ACTIVE before continue
        @param wait_on_delete: force synchronous delete on cleanup
        @param servers_client: the servers_client to create VM
        @param create_kwargs: additional details for instance creation
        @return: server dict
        """
        name = name or data_utils.rand_name('topo-deploy-vm')
        image = image or CONF.compute.image_ref
        flavor = flavor or CONF.compute.flavor_ref
        servers_client = servers_client or self.servers_client
        create_kwargs = create_kwargs or {}
        if type(tenant_id) in (str, unicode):
            if servers_client.tenant_id != tenant_id:
                create_kwargs['tenant_id'] = tenant_id

        xmsg = ("Creating a server name=%(name)s, image=%(image)s"
                ", flavor=%(flavor)s, create_kwargs=%(create_kwargs)s" %
                {'name': name, 'image': image, 'flavor': flavor,
                 'create_kwargs': str(create_kwargs)})
        LOG.debug(xmsg)
        server_resp = servers_client.create_server(
            name=name, imageRef=image, flavorRef=flavor, **create_kwargs)
        server = server_resp['server']
        if wait_on_delete:
            self.addCleanup(
                waiters.wait_for_server_termination,
                servers_client, server['id'])
        self.addCleanup_with_wait(
            waiter_callable=waiters.wait_for_server_termination,
            thing_id=server['id'], thing_id_param='server_id',
            waiter_client=servers_client,
            cleanup_callable=test_utils.call_and_ignore_notfound_exc,
            cleanup_args=[servers_client.delete_server, server['id']])
        if wait_on_boot:
            waiters.wait_for_server_status(
                client=servers_client,
                server_id=server['id'], status='ACTIVE')
        # The instance retrieved on creation is missing network
        # details, necessitating retrieval after it becomes active to
        # ensure correct details.
        server_resp = servers_client.show_server(server['id'])
        server = server_resp['server']
        self.assertEqual(server['name'], name)
        self.servers_on_net[server['id']] = server
        return server 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:54,代码来源:manager_topo_deployment.py


注:本文中的tempest.common.waiters.wait_for_server_termination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。