Merge "Fix cinder volume nameing for admin"

This commit is contained in:
Jenkins 2016-06-09 16:23:44 +00:00 committed by Gerrit Code Review
commit 7f117f60e8
12 changed files with 127 additions and 121 deletions

View File

@ -63,7 +63,7 @@ class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
extra_specs = {spec_key_with_prefix: backend_name_key}
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
self.type = self.volume_types_client.create_volume_type(
self.type = self.admin_volume_types_client.create_volume_type(
name=type_name, extra_specs=extra_specs)['volume_type']
self.volume_type_id_list.append(self.type['id'])
@ -95,7 +95,7 @@ class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
# volume types deletion
volume_type_id_list = getattr(cls, 'volume_type_id_list', [])
for volume_type_id in volume_type_id_list:
cls.volume_types_client.delete_volume_type(volume_type_id)
cls.admin_volume_types_client.delete_volume_type(volume_type_id)
super(VolumeMultiBackendV2Test, cls).resource_cleanup()

View File

@ -43,27 +43,27 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
for key in ['name', 'consumer']:
self.assertEqual(qos[key], body[key])
self.volume_qos_client.delete_qos(body['id'])
self.volume_qos_client.wait_for_resource_deletion(body['id'])
self.admin_volume_qos_client.delete_qos(body['id'])
self.admin_volume_qos_client.wait_for_resource_deletion(body['id'])
# validate the deletion
list_qos = self.volume_qos_client.list_qos()['qos_specs']
list_qos = self.admin_volume_qos_client.list_qos()['qos_specs']
self.assertNotIn(body, list_qos)
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
vol_type = self.admin_volume_types_client.create_volume_type(
name=vol_type_name)['volume_type']
self.addCleanup(self.volume_types_client.delete_volume_type,
self.addCleanup(self.admin_volume_types_client.delete_volume_type,
vol_type['id'])
return vol_type
def _test_associate_qos(self, vol_type_id):
self.volume_qos_client.associate_qos(
self.admin_volume_qos_client.associate_qos(
self.created_qos['id'], vol_type_id)
def _test_get_association_qos(self):
body = self.volume_qos_client.show_association_qos(
body = self.admin_volume_qos_client.show_association_qos(
self.created_qos['id'])['qos_associations']
associations = []
@ -99,7 +99,7 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd')
def test_get_qos(self):
"""Tests the detail of a given qos-specs"""
body = self.volume_qos_client.show_qos(
body = self.admin_volume_qos_client.show_qos(
self.created_qos['id'])['qos_specs']
self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer'])
@ -107,28 +107,29 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('75e04226-bcf7-4595-a34b-fdf0736f38fc')
def test_list_qos(self):
"""Tests the list of all qos-specs"""
body = self.volume_qos_client.list_qos()['qos_specs']
body = self.admin_volume_qos_client.list_qos()['qos_specs']
self.assertIn(self.created_qos, body)
@test.idempotent_id('ed00fd85-4494-45f2-8ceb-9e2048919aed')
def test_set_unset_qos_key(self):
"""Test the addition of a specs key to qos-specs"""
args = {'iops_bytes': '500'}
body = self.volume_qos_client.set_qos_key(
body = self.admin_volume_qos_client.set_qos_key(
self.created_qos['id'],
iops_bytes='500')['qos_specs']
self.assertEqual(args, body)
body = self.volume_qos_client.show_qos(
body = self.admin_volume_qos_client.show_qos(
self.created_qos['id'])['qos_specs']
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs
keys = ['iops_bytes']
self.volume_qos_client.unset_qos_key(self.created_qos['id'], keys)
self.admin_volume_qos_client.unset_qos_key(self.created_qos['id'],
keys)
operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys)
body = self.volume_qos_client.show_qos(
self.admin_volume_qos_client.wait_for_qos_operations(
self.created_qos['id'], operation, keys)
body = self.admin_volume_qos_client.show_qos(
self.created_qos['id'])['qos_specs']
self.assertNotIn(keys[0], body['specs'])
@ -158,21 +159,20 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
self.assertIn(vol_type[i]['id'], associations)
# disassociate a volume-type with qos-specs
self.volume_qos_client.disassociate_qos(
self.admin_volume_qos_client.disassociate_qos(
self.created_qos['id'], vol_type[0]['id'])
operation = 'disassociate'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation,
vol_type[0]['id'])
self.admin_volume_qos_client.wait_for_qos_operations(
self.created_qos['id'], operation, vol_type[0]['id'])
associations = self._test_get_association_qos()
self.assertNotIn(vol_type[0]['id'], associations)
# disassociate all volume-types from qos-specs
self.volume_qos_client.disassociate_all_qos(
self.admin_volume_qos_client.disassociate_all_qos(
self.created_qos['id'])
operation = 'disassociate-all'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation)
self.admin_volume_qos_client.wait_for_qos_operations(
self.created_qos['id'], operation)
associations = self._test_get_association_qos()
self.assertEmpty(associations)

View File

@ -21,7 +21,7 @@ class VolumeHostsAdminV2TestsJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('d5f3efa2-6684-4190-9ced-1c2f526352ad')
def test_list_hosts(self):
hosts = self.hosts_client.list_hosts()['hosts']
hosts = self.admin_hosts_client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 2, "No. of hosts are < 2,"
"response of list hosts is: % s" % hosts)

View File

@ -37,14 +37,14 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
def test_list_quotas(self):
quotas = (self.quotas_client.show_quota_set(self.demo_tenant_id)
quotas = (self.admin_quotas_client.show_quota_set(self.demo_tenant_id)
['quota_set'])
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')
def test_list_default_quotas(self):
quotas = self.quotas_client.show_default_quota_set(
quotas = self.admin_quotas_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@ -52,21 +52,21 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('3d45c99e-cc42-4424-a56e-5cbd212b63a6')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
default_quota_set = self.quotas_client.show_default_quota_set(
default_quota_set = self.admin_quotas_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
new_quota_set = {'gigabytes': 1009,
'volumes': 11,
'snapshots': 11}
# Update limits for all quota resources
quota_set = self.quotas_client.update_quota_set(
quota_set = self.admin_quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)['quota_set']
cleanup_quota_set = dict(
(k, v) for k, v in six.iteritems(default_quota_set)
if k in QUOTA_KEYS)
self.addCleanup(self.quotas_client.update_quota_set,
self.addCleanup(self.admin_quotas_client.update_quota_set,
self.demo_tenant_id, **cleanup_quota_set)
# test that the specific values we set are actually in
# the final result. There is nothing here that ensures there
@ -75,7 +75,7 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
def test_show_quota_usage(self):
quota_usage = self.quotas_client.show_quota_usage(
quota_usage = self.admin_quotas_client.show_quota_usage(
self.os_adm.credentials.tenant_id)['quota_set']
for key in QUOTA_KEYS:
self.assertIn(key, quota_usage)
@ -84,13 +84,13 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')
def test_quota_usage(self):
quota_usage = self.quotas_client.show_quota_usage(
quota_usage = self.admin_quotas_client.show_quota_usage(
self.demo_tenant_id)['quota_set']
volume = self.create_volume()
self.addCleanup(self._delete_volume, volume['id'])
new_quota_usage = self.quotas_client.show_quota_usage(
new_quota_usage = self.admin_quotas_client.show_quota_usage(
self.demo_tenant_id)['quota_set']
self.assertEqual(quota_usage['volumes']['in_use'] + 1,
@ -109,15 +109,15 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
description=description)
project_id = project['id']
self.addCleanup(self.identity_utils.delete_project, project_id)
quota_set_default = self.quotas_client.show_default_quota_set(
quota_set_default = self.admin_quotas_client.show_default_quota_set(
project_id)['quota_set']
volume_default = quota_set_default['volumes']
self.quotas_client.update_quota_set(project_id,
volumes=(int(volume_default) + 5))
self.admin_quotas_client.update_quota_set(
project_id, volumes=(int(volume_default) + 5))
self.quotas_client.delete_quota_set(project_id)
quota_set_new = (self.quotas_client.show_quota_set(project_id)
self.admin_quotas_client.delete_quota_set(project_id)
quota_set_new = (self.admin_quotas_client.show_quota_set(project_id)
['quota_set'])
self.assertEqual(volume_default, quota_set_new['volumes'])

View File

@ -38,7 +38,7 @@ class BaseVolumeQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with dynamic credentials.
cls.quotas_client.update_quota_set(
cls.admin_quotas_client.update_quota_set(
cls.demo_tenant_id,
**cls.shared_quota_set)
@ -58,12 +58,12 @@ class BaseVolumeQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
# NOTE(gfidente): quota set needs to be changed for this test
# or we may be limited by the volumes or snaps quota number, not by
# actual gigs usage; next line ensures shared set is restored.
self.addCleanup(self.quotas_client.update_quota_set,
self.addCleanup(self.admin_quotas_client.update_quota_set,
self.demo_tenant_id,
**self.shared_quota_set)
new_quota_set = {'gigabytes': self.default_volume_size,
'volumes': 2, 'snapshots': 1}
self.quotas_client.update_quota_set(
self.admin_quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
self.assertRaises(lib_exc.OverLimit,

View File

@ -44,7 +44,7 @@ class VolumeSnapshotQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with tenant isolation.
cls.quotas_client.update_quota_set(
cls.admin_quotas_client.update_quota_set(
cls.demo_tenant_id,
**cls.shared_quota_set)
@ -63,12 +63,12 @@ class VolumeSnapshotQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
@test.attr(type='negative')
@test.idempotent_id('c99a1ca9-6cdf-498d-9fdf-25832babef27')
def test_quota_volume_gigabytes_snapshots(self):
self.addCleanup(self.quotas_client.update_quota_set,
self.addCleanup(self.admin_quotas_client.update_quota_set,
self.demo_tenant_id,
**self.shared_quota_set)
new_quota_set = {'gigabytes': 2 * self.default_volume_size,
'volumes': 1, 'snapshots': 2}
self.quotas_client.update_quota_set(
self.admin_quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
self.assertRaises(lib_exc.OverLimit,

View File

@ -31,7 +31,8 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
@test.idempotent_id('9d9b28e3-1b2e-4483-a2cc-24aa0ea1de54')
def test_volume_type_list(self):
# List volume types.
body = self.volume_types_client.list_volume_types()['volume_types']
body = \
self.admin_volume_types_client.list_volume_types()['volume_types']
self.assertIsInstance(body, list)
@test.idempotent_id('c03cc62c-f4e9-4623-91ec-64ce2f9c1260')
@ -47,11 +48,11 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
# Create two volume_types
for i in range(2):
vol_type_name = data_utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
vol_type = self.admin_volume_types_client.create_volume_type(
name=vol_type_name,
extra_specs=extra_specs)['volume_type']
volume_types.append(vol_type)
self.addCleanup(self.volume_types_client.delete_volume_type,
self.addCleanup(self.admin_volume_types_client.delete_volume_type,
vol_type['id'])
params = {self.name_field: vol_name,
'volume_type': volume_types[0]['id']}
@ -97,11 +98,11 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
body = self.volume_types_client.create_volume_type(
body = self.admin_volume_types_client.create_volume_type(
name=name,
extra_specs=extra_specs)['volume_type']
self.assertIn('id', body)
self.addCleanup(self.volume_types_client.delete_volume_type,
self.addCleanup(self.admin_volume_types_client.delete_volume_type,
body['id'])
self.assertIn('name', body)
self.assertEqual(body['name'], name,
@ -109,7 +110,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
"to the requested name")
self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.")
fetched_volume_type = self.volume_types_client.show_volume_type(
fetched_volume_type = self.admin_volume_types_client.show_volume_type(
body['id'])['volume_type']
self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different '
@ -127,15 +128,16 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type")
body = self.volume_types_client.create_volume_type(
body = self.admin_volume_types_client.create_volume_type(
name=name)['volume_type']
self.addCleanup(self.volume_types_client.delete_volume_type,
self.addCleanup(self.admin_volume_types_client.delete_volume_type,
body['id'])
# Create encryption type
encryption_type = self.volume_types_client.create_encryption_type(
body['id'], provider=provider,
control_location=control_location)['encryption']
encryption_type = \
self.admin_volume_types_client.create_encryption_type(
body['id'], provider=provider,
control_location=control_location)['encryption']
self.assertIn('volume_type_id', encryption_type)
self.assertEqual(provider, encryption_type['provider'],
"The created encryption_type provider is not equal "
@ -146,7 +148,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
# Get encryption type
fetched_encryption_type = (
self.volume_types_client.show_encryption_type(
self.admin_volume_types_client.show_encryption_type(
encryption_type['volume_type_id']))
self.assertEqual(provider,
fetched_encryption_type['provider'],
@ -158,13 +160,13 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
'different from the created encryption_type')
# Delete encryption type
self.volume_types_client.delete_encryption_type(
self.admin_volume_types_client.delete_encryption_type(
encryption_type['volume_type_id'])
resource = {"id": encryption_type['volume_type_id'],
"type": "encryption-type"}
self.volume_types_client.wait_for_resource_deletion(resource)
self.admin_volume_types_client.wait_for_resource_deletion(resource)
deleted_encryption_type = (
self.volume_types_client.show_encryption_type(
self.admin_volume_types_client.show_encryption_type(
encryption_type['volume_type_id']))
self.assertEmpty(deleted_encryption_type)

View File

@ -24,23 +24,24 @@ class VolumeTypesExtraSpecsV2Test(base.BaseVolumeAdminTest):
def resource_setup(cls):
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.volume_type = cls.volume_types_client.create_volume_type(
name=vol_type_name)['volume_type']
cls.volume_type = \
cls.admin_volume_types_client.create_volume_type(
name=vol_type_name)['volume_type']
@classmethod
def resource_cleanup(cls):
cls.volume_types_client.delete_volume_type(cls.volume_type['id'])
cls.admin_volume_types_client.delete_volume_type(cls.volume_type['id'])
super(VolumeTypesExtraSpecsV2Test, cls).resource_cleanup()
@test.idempotent_id('b42923e9-0452-4945-be5b-d362ae533e60')
def test_volume_type_extra_specs_list(self):
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
body = self.admin_volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
body = self.volume_types_client.list_volume_types_extra_specs(
body = self.admin_volume_types_client.list_volume_types_extra_specs(
self.volume_type['id'])['extra_specs']
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@ -49,13 +50,13 @@ class VolumeTypesExtraSpecsV2Test(base.BaseVolumeAdminTest):
def test_volume_type_extra_specs_update(self):
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
body = self.admin_volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
extra_spec = {"spec2": "val2"}
body = self.volume_types_client.update_volume_type_extra_specs(
body = self.admin_volume_types_client.update_volume_type_extra_specs(
self.volume_type['id'],
extra_spec.keys()[0],
extra_spec)
@ -67,19 +68,19 @@ class VolumeTypesExtraSpecsV2Test(base.BaseVolumeAdminTest):
def test_volume_type_extra_spec_create_get_delete(self):
# Create/Get/Delete volume type extra spec.
extra_specs = {"spec3": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
body = self.admin_volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'],
extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
self.volume_types_client.show_volume_type_extra_specs(
self.admin_volume_types_client.show_volume_type_extra_specs(
self.volume_type['id'],
extra_specs.keys()[0])
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly fetched")
self.volume_types_client.delete_volume_type_extra_specs(
self.admin_volume_types_client.delete_volume_type_extra_specs(
self.volume_type['id'],
extra_specs.keys()[0])

View File

@ -26,13 +26,13 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
super(ExtraSpecsNegativeV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.extra_specs = {"spec1": "val1"}
cls.volume_type = cls.volume_types_client.create_volume_type(
cls.volume_type = cls.admin_volume_types_client.create_volume_type(
name=vol_type_name,
extra_specs=cls.extra_specs)['volume_type']
@classmethod
def resource_cleanup(cls):
cls.volume_types_client.delete_volume_type(cls.volume_type['id'])
cls.admin_volume_types_client.delete_volume_type(cls.volume_type['id'])
super(ExtraSpecsNegativeV2Test, cls).resource_cleanup()
@test.idempotent_id('08961d20-5cbb-4910-ac0f-89ad6dbb2da1')
@ -41,7 +41,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_spec = {"spec1": "val2"}
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.admin_volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0], None)
@test.idempotent_id('25e5a0ee-89b3-4c53-8310-236f76c75365')
@ -50,7 +50,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_spec = {"spec1": "val2"}
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.admin_volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], data_utils.rand_uuid(),
extra_spec)
@ -60,7 +60,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_spec = {"spec1": "val2"}
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.admin_volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], None, extra_spec)
@test.idempotent_id('a77dfda2-9100-448e-9076-ed1711f4bdfc')
@ -70,7 +70,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_spec = {"spec1": "val2", "spec2": "val1"}
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.admin_volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0],
extra_spec)
@ -81,7 +81,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_specs = {"spec2": "val1"}
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.create_volume_type_extra_specs,
self.admin_volume_types_client.create_volume_type_extra_specs,
data_utils.rand_uuid(), extra_specs)
@test.idempotent_id('c821bdc8-43a4-4bf4-86c8-82f3858d5f7d')
@ -89,7 +89,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
# Should not create volume type extra spec for none POST body.
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.admin_volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], None)
@test.idempotent_id('bc772c71-1ed4-4716-b945-8b5ed0f15e87')
@ -97,7 +97,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
# Should not create volume type extra spec for invalid POST body.
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.admin_volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], extra_specs=['invalid'])
@test.idempotent_id('031cda8b-7d23-4246-8bf6-bbe73fd67074')
@ -107,7 +107,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_specs = {"spec1": "val1"}
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.delete_volume_type_extra_specs,
self.admin_volume_types_client.delete_volume_type_extra_specs,
data_utils.rand_uuid(), extra_specs.keys()[0])
@test.idempotent_id('dee5cf0c-cdd6-4353-b70c-e847050d71fb')
@ -115,7 +115,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
# Should not list volume type extra spec for nonexistent type id.
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.list_volume_types_extra_specs,
self.admin_volume_types_client.list_volume_types_extra_specs,
data_utils.rand_uuid())
@test.idempotent_id('9f402cbd-1838-4eb4-9554-126a6b1908c9')
@ -124,7 +124,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_specs = {"spec1": "val1"}
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.show_volume_type_extra_specs,
self.admin_volume_types_client.show_volume_type_extra_specs,
data_utils.rand_uuid(), extra_specs.keys()[0])
@test.idempotent_id('c881797d-12ff-4f1a-b09d-9f6212159753')
@ -133,7 +133,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
# id.
self.assertRaises(
lib_exc.NotFound,
self.volume_types_client.show_volume_type_extra_specs,
self.admin_volume_types_client.show_volume_type_extra_specs,
self.volume_type['id'], data_utils.rand_uuid())

View File

@ -33,21 +33,22 @@ class VolumeTypesNegativeV2Test(base.BaseVolumeAdminTest):
@test.idempotent_id('878b4e57-faa2-4659-b0d1-ce740a06ae81')
def test_create_with_empty_name(self):
# Should not be able to create volume type with an empty name.
self.assertRaises(lib_exc.BadRequest,
self.volume_types_client.create_volume_type, name='')
self.assertRaises(
lib_exc.BadRequest,
self.admin_volume_types_client.create_volume_type, name='')
@test.idempotent_id('994610d6-0476-4018-a644-a2602ef5d4aa')
def test_get_nonexistent_type_id(self):
# Should not be able to get volume type with nonexistent type id.
self.assertRaises(lib_exc.NotFound,
self.volume_types_client.show_volume_type,
self.admin_volume_types_client.show_volume_type,
data_utils.rand_uuid())
@test.idempotent_id('6b3926d2-7d73-4896-bc3d-e42dfd11a9f6')
def test_delete_nonexistent_type_id(self):
# Should not be able to delete volume type with nonexistent type id.
self.assertRaises(lib_exc.NotFound,
self.volume_types_client.delete_volume_type,
self.admin_volume_types_client.delete_volume_type,
data_utils.rand_uuid())

View File

@ -42,8 +42,8 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
cls.volume = cls.create_volume()
def _delete_backup(self, backup_id):
self.backups_adm_client.delete_backup(backup_id)
self.backups_adm_client.wait_for_backup_deletion(backup_id)
self.admin_backups_client.delete_backup(backup_id)
self.admin_backups_client.wait_for_backup_deletion(backup_id)
def _decode_url(self, backup_url):
return json.loads(base64.decodestring(backup_url))
@ -63,36 +63,37 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
def test_volume_backup_create_get_detailed_list_restore_delete(self):
# Create backup
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
create_backup = self.admin_backups_client.create_backup
backup = create_backup(volume_id=self.volume['id'],
name=backup_name)['backup']
self.addCleanup(self.backups_adm_client.delete_backup,
self.addCleanup(self.admin_backups_client.delete_backup,
backup['id'])
self.assertEqual(backup_name, backup['name'])
waiters.wait_for_volume_status(self.admin_volume_client,
self.volume['id'], 'available')
self.backups_adm_client.wait_for_backup_status(backup['id'],
'available')
self.admin_backups_client.wait_for_backup_status(backup['id'],
'available')
# Get a given backup
backup = self.backups_adm_client.show_backup(backup['id'])['backup']
backup = self.admin_backups_client.show_backup(backup['id'])['backup']
self.assertEqual(backup_name, backup['name'])
# Get all backups with detail
backups = self.backups_adm_client.list_backups(detail=True)['backups']
backups = self.admin_backups_client.list_backups(
detail=True)['backups']
self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups])
# Restore backup
restore = self.backups_adm_client.restore_backup(
restore = self.admin_backups_client.restore_backup(
backup['id'])['restore']
# Delete backup
self.addCleanup(self.admin_volume_client.delete_volume,
restore['volume_id'])
self.assertEqual(backup['id'], restore['backup_id'])
self.backups_adm_client.wait_for_backup_status(backup['id'],
'available')
self.admin_backups_client.wait_for_backup_status(backup['id'],
'available')
waiters.wait_for_volume_status(self.admin_volume_client,
restore['volume_id'], 'available')
@ -105,15 +106,15 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
"""
# Create backup
backup_name = data_utils.rand_name('Backup')
backup = (self.backups_adm_client.create_backup(
backup = (self.admin_backups_client.create_backup(
volume_id=self.volume['id'], name=backup_name)['backup'])
self.addCleanup(self._delete_backup, backup['id'])
self.assertEqual(backup_name, backup['name'])
self.backups_adm_client.wait_for_backup_status(backup['id'],
'available')
self.admin_backups_client.wait_for_backup_status(backup['id'],
'available')
# Export Backup
export_backup = (self.backups_adm_client.export_backup(backup['id'])
export_backup = (self.admin_backups_client.export_backup(backup['id'])
['backup-record'])
self.assertIn('backup_service', export_backup)
self.assertIn('backup_url', export_backup)
@ -132,7 +133,7 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
export_backup['backup_url'], {'id': new_id})
# Import Backup
import_backup = self.backups_adm_client.import_backup(
import_backup = self.admin_backups_client.import_backup(
backup_service=export_backup['backup_service'],
backup_url=new_url)['backup']
@ -142,15 +143,16 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
self.addCleanup(self._delete_backup, new_id)
self.assertIn("id", import_backup)
self.assertEqual(new_id, import_backup['id'])
self.backups_adm_client.wait_for_backup_status(import_backup['id'],
'available')
self.admin_backups_client.wait_for_backup_status(import_backup['id'],
'available')
# Verify Import Backup
backups = self.backups_adm_client.list_backups(detail=True)['backups']
backups = self.admin_backups_client.list_backups(
detail=True)['backups']
self.assertIn(new_id, [b['id'] for b in backups])
# Restore backup
restore = self.backups_adm_client.restore_backup(
restore = self.admin_backups_client.restore_backup(
backup['id'])['restore']
self.addCleanup(self.admin_volume_client.delete_volume,
restore['volume_id'])
@ -161,8 +163,8 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
# Verify if restored volume is there in volume list
volumes = self.admin_volume_client.list_volumes()['volumes']
self.assertIn(restore['volume_id'], [v['id'] for v in volumes])
self.backups_adm_client.wait_for_backup_status(import_backup['id'],
'available')
self.admin_backups_client.wait_for_backup_status(import_backup['id'],
'available')
class VolumesBackupsV1Test(VolumesBackupsV2Test):

View File

@ -179,25 +179,25 @@ class BaseVolumeAdminTest(BaseVolumeTest):
super(BaseVolumeAdminTest, cls).setup_clients()
if cls._api_version == 1:
cls.volume_qos_client = cls.os_adm.volume_qos_client
cls.admin_volume_qos_client = cls.os_adm.volume_qos_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_client
cls.volume_types_client = cls.os_adm.volume_types_client
cls.admin_volume_types_client = cls.os_adm.volume_types_client
cls.admin_volume_client = cls.os_adm.volumes_client
cls.hosts_client = cls.os_adm.volume_hosts_client
cls.admin_hosts_client = cls.os_adm.volume_hosts_client
cls.admin_snapshots_client = cls.os_adm.snapshots_client
cls.backups_adm_client = cls.os_adm.backups_client
cls.quotas_client = cls.os_adm.volume_quotas_client
cls.admin_backups_client = cls.os_adm.backups_client
cls.admin_quotas_client = cls.os_adm.volume_quotas_client
elif cls._api_version == 2:
cls.volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_v2_client
cls.volume_types_client = cls.os_adm.volume_types_v2_client
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
cls.admin_volume_client = cls.os_adm.volumes_v2_client
cls.hosts_client = cls.os_adm.volume_hosts_v2_client
cls.admin_hosts_client = cls.os_adm.volume_hosts_v2_client
cls.admin_snapshots_client = cls.os_adm.snapshots_v2_client
cls.backups_adm_client = cls.os_adm.backups_v2_client
cls.quotas_client = cls.os_adm.volume_quotas_v2_client
cls.admin_backups_client = cls.os_adm.backups_v2_client
cls.admin_quotas_client = cls.os_adm.volume_quotas_v2_client
@classmethod
def resource_setup(cls):
@ -215,7 +215,7 @@ class BaseVolumeAdminTest(BaseVolumeTest):
"""create a test Qos-Specs."""
name = name or data_utils.rand_name(cls.__name__ + '-QoS')
consumer = consumer or 'front-end'
qos_specs = cls.volume_qos_client.create_qos(
qos_specs = cls.admin_volume_qos_client.create_qos(
name=name, consumer=consumer, **kwargs)['qos_specs']
cls.qos_specs.append(qos_specs['id'])
return qos_specs
@ -224,8 +224,8 @@ class BaseVolumeAdminTest(BaseVolumeTest):
def clear_qos_specs(cls):
for qos_id in cls.qos_specs:
test_utils.call_and_ignore_notfound_exc(
cls.volume_qos_client.delete_qos, qos_id)
cls.admin_volume_qos_client.delete_qos, qos_id)
for qos_id in cls.qos_specs:
test_utils.call_and_ignore_notfound_exc(
cls.volume_qos_client.wait_for_resource_deletion, qos_id)
cls.admin_volume_qos_client.wait_for_resource_deletion, qos_id)