本文整理汇总了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)
示例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')
示例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')
示例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']
示例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
示例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']
示例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'])
示例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
示例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
示例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)
示例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')
示例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')
示例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)
示例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)
示例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)