當前位置: 首頁>>代碼示例>>Python>>正文


Python waiters.wait_for_volume_resource_status方法代碼示例

本文整理匯總了Python中tempest.common.waiters.wait_for_volume_resource_status方法的典型用法代碼示例。如果您正苦於以下問題:Python waiters.wait_for_volume_resource_status方法的具體用法?Python waiters.wait_for_volume_resource_status怎麽用?Python waiters.wait_for_volume_resource_status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tempest.common.waiters的用法示例。


在下文中一共展示了waiters.wait_for_volume_resource_status方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _manage_volume

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def _manage_volume(self, org_volume):
        # Manage volume
        new_volume_name = data_utils.rand_name(
            self.__class__.__name__ + '-volume')

        new_volume_ref = {
            'name': new_volume_name,
            'host': org_volume['os-vol-host-attr:host'],
            'ref': {CONF.volume.manage_volume_ref[0]:
                    CONF.volume.manage_volume_ref[1] % org_volume['id']},
            'volume_type': org_volume['volume_type'],
            'availability_zone': org_volume['availability_zone']}

        new_volume_id = self.volume_manage_client.manage_volume(
            **new_volume_ref)['volume']['id']

        waiters.wait_for_volume_resource_status(self.admin_volumes_client,
                                                new_volume_id, 'available')
        self.addCleanup(self.delete_volume,
                        self.volumes_client, new_volume_id) 
開發者ID:openstack,項目名稱:patrole,代碼行數:22,代碼來源:test_volumes_manage_rbac.py

示例2: test_volume_upload

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_volume_upload(self):
        # TODO(felipemonteiro): The ``upload_volume`` endpoint also enforces
        # "volume:copy_volume_to_image" but is not currently contained in
        # Cinder's policy.json.
        image_name = data_utils.rand_name(self.__class__.__name__ + '-Image')

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        body = self.volumes_client.upload_volume(
            self.volume['id'], image_name=image_name, visibility="private",
            disk_format=CONF.volume.disk_format)['os-volume_upload_image']
        image_id = body["image_id"]
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.admin_image_client.delete_image,
                        image_id)
        waiters.wait_for_image_status(self.admin_image_client, image_id,
                                      'active')
        waiters.wait_for_volume_resource_status(self.admin_volumes_client,
                                                self.volume['id'], 'available') 
開發者ID:openstack,項目名稱:patrole,代碼行數:20,代碼來源:test_volume_actions_rbac.py

示例3: test_volume_upload_public

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_volume_upload_public(self):
        # This also enforces "volume_extension:volume_actions:upload_image".
        volume = self.create_volume()
        image_name = data_utils.rand_name(self.__class__.__name__ + '-Image')

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        body = self.volumes_client.upload_volume(
            volume['id'], image_name=image_name, visibility="public",
            disk_format=CONF.volume.disk_format)['os-volume_upload_image']
        image_id = body["image_id"]
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.admin_image_client.delete_image,
                        image_id)
        waiters.wait_for_image_status(self.admin_image_client, image_id,
                                      'active')
        waiters.wait_for_volume_resource_status(self.admin_volumes_client,
                                                volume['id'], 'available') 
開發者ID:openstack,項目名稱:patrole,代碼行數:19,代碼來源:test_volume_actions_rbac.py

示例4: create_test_volume

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def create_test_volume(self, size=None, volume_type=None):
        name = data_utils.rand_name(self.__class__.__name__)

        if size is None:
            size = CONF.volume.volume_size

        kwargs = {
            'display_name': name,
            'volume_type': volume_type,
            'size': size
        }

        volume = self.volumes_client.create_volume(**kwargs)['volume']
        waiters.wait_for_volume_resource_status(self.volumes_client,
                                                volume['id'], 'available')

        return self.volumes_client.show_volume(volume['id'])['volume'] 
開發者ID:openstack,項目名稱:almanach,代碼行數:19,代碼來源:base.py

示例5: create_volume

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def create_volume(self, size=None, name=None, snapshot_id=None,
                      imageRef=None, volume_type=None):
        if size is None:
            size = CONF.volume.volume_size
        if imageRef:
            image = self.compute_images_client.show_image(imageRef)['image']
            min_disk = image.get('minDisk')
            size = max(size, min_disk)
        if name is None:
            name = data_utils.rand_name(self.__class__.__name__ + "-volume")
        kwargs = {'display_name': name,
                  'snapshot_id': snapshot_id,
                  'imageRef': imageRef,
                  'volume_type': volume_type,
                  'size': size}
        volume = self.volumes_client.create_volume(**kwargs)['volume']

        self.addCleanup(self.volumes_client.wait_for_resource_deletion,
                        volume['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.volumes_client.delete_volume, volume['id'])

        # NOTE(e0ne): Cinder API v2 uses name instead of display_name
        if 'display_name' in volume:
            self.assertEqual(name, volume['display_name'])
        else:
            self.assertEqual(name, volume['name'])
        waiters.wait_for_volume_resource_status(self.volumes_client,
                                                volume['id'], 'available')
        # The volume retrieved on creation has a non-up-to-date status.
        # Retrieval after it becomes active ensures correct details.
        volume = self.volumes_client.show_volume(volume['id'])['volume']
        return volume 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:35,代碼來源:manager.py

示例6: nova_volume_attach

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def nova_volume_attach(self, server, volume_to_attach):
        volume = self.servers_client.attach_volume(
            server['id'], volumeId=volume_to_attach['id'], device='/dev/%s'
            % CONF.compute.volume_device_name)['volumeAttachment']
        self.assertEqual(volume_to_attach['id'], volume['id'])
        waiters.wait_for_volume_resource_status(self.volumes_client,
                                                volume['id'], 'in-use')

        # Return the updated volume after the attachment
        return self.volumes_client.show_volume(volume['id'])['volume'] 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:12,代碼來源:manager.py

示例7: nova_volume_detach

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def nova_volume_detach(self, server, volume):
        self.servers_client.detach_volume(server['id'], volume['id'])
        waiters.wait_for_volume_resource_status(self.volumes_client,
                                                volume['id'], 'available')

        volume = self.volumes_client.show_volume(volume['id'])['volume']
        self.assertEqual('available', volume['status']) 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:9,代碼來源:manager.py

示例8: create_volume

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def create_volume(self, size=None, name=None, snapshot_id=None,
                      image_id=None, volume_type=None):
        if size is None:
            size = CONF.volume.volume_size
        if image_id is None:
            image = self.compute_images_client.show_image(image_id)['image']
            min_disk = image.get('minDisk')
            size = max(size, min_disk)
        if name is None:
            name = data_utils.rand_name(self.__class__.__name__ + "-volume")
        kwargs = {'display_name': name,
                  'snapshot_id': snapshot_id,
                  'imageRef': image_id,
                  'volume_type': volume_type,
                  'size': size}
        volume = self.volumes_client.create_volume(**kwargs)['volume']

        self.addCleanup(self.volumes_client.wait_for_resource_deletion,
                        volume['id'])
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.volumes_client.delete_volume, volume['id'])
        self.assertEqual(name, volume['name'])
        waiters.wait_for_volume_resource_status(self.volumes_client,
                                                volume['id'], 'available')
        # The volume retrieved on creation has a non-up-to-date status.
        # Retrieval after it becomes active ensures correct details.
        volume = self.volumes_client.show_volume(volume['id'])['volume']
        return volume 
開發者ID:openstack,項目名稱:ironic-tempest-plugin,代碼行數:30,代碼來源:test_baremetal_boot_from_volume.py

示例9: _create_group

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def _create_group(self, name=None, ignore_notfound=False, **kwargs):
        group_name = name or data_utils.rand_name(
            self.__class__.__name__ + '-Group')
        group = self.groups_client.create_group(name=group_name, **kwargs)[
            'group']
        if ignore_notfound:
            self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                            self._delete_group, group['id'])
        else:
            self.addCleanup(self._delete_group, group['id'])
        waiters.wait_for_volume_resource_status(
            self.admin_groups_client, group['id'], 'available')
        return group 
開發者ID:openstack,項目名稱:patrole,代碼行數:15,代碼來源:test_groups_rbac.py

示例10: test_reset_group_status

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_reset_group_status(self):
        group = self._create_group(ignore_notfound=False,
                                   group_type=self.group_type_id,
                                   volume_types=[self.volume_type_id])
        status = 'available'
        with self.rbac_utils.override_role(self):
            self.groups_client.reset_group_status(group['id'],
                                                  status)
        waiters.wait_for_volume_resource_status(
            self.groups_client, group['id'], status) 
開發者ID:openstack,項目名稱:patrole,代碼行數:12,代碼來源:test_groups_rbac.py

示例11: test_snapshot_update

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_snapshot_update(self):
        new_desc = 'This is the new description of snapshot.'
        params = {'description': new_desc}
        # Updates snapshot with new values
        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        self.snapshots_client.update_snapshot(
            self.snapshot['id'], **params)['snapshot']
        waiters.wait_for_volume_resource_status(
            self.admin_snapshots_client, self.snapshot['id'], 'available') 
開發者ID:openstack,項目名稱:patrole,代碼行數:11,代碼來源:test_volumes_snapshots_rbac.py

示例12: test_volume_extend

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_volume_extend(self):
        # Extend volume test
        extend_size = int(self.volume['size']) + 1
        with self.rbac_utils.override_role(self):
            self.volumes_client.extend_volume(self.volume['id'],
                                              new_size=extend_size)
        waiters.wait_for_volume_resource_status(
            self.volumes_client, self.volume['id'], 'available') 
開發者ID:openstack,項目名稱:patrole,代碼行數:10,代碼來源:test_volumes_extend_rbac.py

示例13: test_reset_snapshot_status

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_reset_snapshot_status(self):
        status = 'error'
        with self.rbac_utils.override_role(self):
            self.snapshots_client.reset_snapshot_status(
                self.snapshot['id'], status)
        waiters.wait_for_volume_resource_status(
            self.snapshots_client, self.snapshot['id'], status) 
開發者ID:openstack,項目名稱:patrole,代碼行數:9,代碼來源:test_snapshots_actions_rbac.py

示例14: test_update_snapshot_status

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def test_update_snapshot_status(self):
        status = 'creating'
        self.snapshots_client.reset_snapshot_status(
            self.snapshot['id'], status)
        waiters.wait_for_volume_resource_status(self.snapshots_client,
                                                self.snapshot['id'], status)
        with self.rbac_utils.override_role(self):
            self.snapshots_client.update_snapshot_status(self.snapshot['id'],
                                                         status="creating")
        waiters.wait_for_volume_resource_status(
            self.snapshots_client, self.snapshot['id'], status) 
開發者ID:openstack,項目名稱:patrole,代碼行數:13,代碼來源:test_snapshots_actions_rbac.py

示例15: _attach_volume

# 需要導入模塊: from tempest.common import waiters [as 別名]
# 或者: from tempest.common.waiters import wait_for_volume_resource_status [as 別名]
def _attach_volume(self, server, volume_id=None):
        if volume_id is None:
            volume_id = self.volume['id']

        self.servers_client.attach_volume(
            server['id'], volumeId=volume_id,
            device='/dev/%s' % CONF.compute.volume_device_name)
        waiters.wait_for_volume_resource_status(
            self.admin_volumes_client, volume_id, 'in-use')
        self.addCleanup(self._detach_volume, volume_id) 
開發者ID:openstack,項目名稱:patrole,代碼行數:12,代碼來源:test_volume_actions_rbac.py


注:本文中的tempest.common.waiters.wait_for_volume_resource_status方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。