Apply a naming rule of GET to volume client

[GET /resources] methods should be "list_<resource name>s"
or "show_<resource name>", so this patch applies the rule
to volume client.

Partially implements blueprint consistent-service-method-names

Change-Id: I843dd43293f40bf673a033b1dbf24e035bc8f0c3
This commit is contained in:
Ken'ichi Ohmichi
2015-04-06 01:22:41 +00:00
parent 564450cf58
commit 35798fb10a
33 changed files with 126 additions and 140 deletions

View File

@@ -34,7 +34,7 @@ class CinderResourcesTest(base.BaseOrchestrationTest):
def _cinder_verify(self, volume_id, template): def _cinder_verify(self, volume_id, template):
self.assertIsNotNone(volume_id) self.assertIsNotNone(volume_id)
volume = self.volumes_client.get_volume(volume_id) volume = self.volumes_client.show_volume(volume_id)
self.assertEqual('available', volume.get('status')) self.assertEqual('available', volume.get('status'))
self.assertEqual(template['resources']['volume']['properties'][ self.assertEqual(template['resources']['volume']['properties'][
'size'], volume.get('size')) 'size'], volume.get('size'))
@@ -76,7 +76,7 @@ class CinderResourcesTest(base.BaseOrchestrationTest):
self.client.delete_stack(stack_identifier) self.client.delete_stack(stack_identifier)
self.client.wait_for_stack_status(stack_identifier, 'DELETE_COMPLETE') self.client.wait_for_stack_status(stack_identifier, 'DELETE_COMPLETE')
self.assertRaises(lib_exc.NotFound, self.assertRaises(lib_exc.NotFound,
self.volumes_client.get_volume, self.volumes_client.show_volume,
volume_id) volume_id)
def _cleanup_volume(self, volume_id): def _cleanup_volume(self, volume_id):

View File

@@ -139,7 +139,7 @@ class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
# the multi backend feature has been enabled # the multi backend feature has been enabled
# if multi-backend is enabled: os-vol-attr:host should be like: # if multi-backend is enabled: os-vol-attr:host should be like:
# host@backend_name # host@backend_name
volume = self.admin_volume_client.get_volume(volume_id) volume = self.admin_volume_client.show_volume(volume_id)
volume1_host = volume['os-vol-host-attr:host'] volume1_host = volume['os-vol-host-attr:host']
msg = ("multi-backend reporting incorrect values for volume %s" % msg = ("multi-backend reporting incorrect values for volume %s" %
@@ -150,10 +150,10 @@ class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
# this test checks that the two volumes created at setUp don't # this test checks that the two volumes created at setUp don't
# belong to the same backend (if they are, than the # belong to the same backend (if they are, than the
# volume backend distinction is not working properly) # volume backend distinction is not working properly)
volume = self.admin_volume_client.get_volume(volume1_id) volume = self.admin_volume_client.show_volume(volume1_id)
volume1_host = volume['os-vol-host-attr:host'] volume1_host = volume['os-vol-host-attr:host']
volume = self.admin_volume_client.get_volume(volume2_id) volume = self.admin_volume_client.show_volume(volume2_id)
volume2_host = volume['os-vol-host-attr:host'] volume2_host = volume['os-vol-host-attr:host']
msg = ("volumes %s and %s were created in the same backend" % msg = ("volumes %s and %s were created in the same backend" %

View File

@@ -89,7 +89,7 @@ class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
self.admin_snapshots_client.\ self.admin_snapshots_client.\
reset_snapshot_status(self.snapshot['id'], status) reset_snapshot_status(self.snapshot['id'], status)
snapshot_get \ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id']) = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status']) self.assertEqual(status, snapshot_get['status'])
@test.attr(type='gate') @test.attr(type='gate')
@@ -107,7 +107,7 @@ class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
self.client.update_snapshot_status(self.snapshot['id'], self.client.update_snapshot_status(self.snapshot['id'],
status, progress) status, progress)
snapshot_get \ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id']) = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status']) self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias]) self.assertEqual(progress, snapshot_get[progress_alias])

View File

@@ -32,14 +32,14 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.attr(type='gate') @test.attr(type='gate')
@test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0') @test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
def test_list_quotas(self): def test_list_quotas(self):
quotas = self.quotas_client.get_quota_set(self.demo_tenant_id) quotas = self.quotas_client.show_quota_set(self.demo_tenant_id)
for key in QUOTA_KEYS: for key in QUOTA_KEYS:
self.assertIn(key, quotas) self.assertIn(key, quotas)
@test.attr(type='gate') @test.attr(type='gate')
@test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7') @test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')
def test_list_default_quotas(self): def test_list_default_quotas(self):
quotas = self.quotas_client.get_default_quota_set( quotas = self.quotas_client.show_default_quota_set(
self.demo_tenant_id) self.demo_tenant_id)
for key in QUOTA_KEYS: for key in QUOTA_KEYS:
self.assertIn(key, quotas) self.assertIn(key, quotas)
@@ -48,7 +48,7 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('3d45c99e-cc42-4424-a56e-5cbd212b63a6') @test.idempotent_id('3d45c99e-cc42-4424-a56e-5cbd212b63a6')
def test_update_all_quota_resources_for_tenant(self): def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant # Admin can update all the resource quota limits for a tenant
default_quota_set = self.quotas_client.get_default_quota_set( default_quota_set = self.quotas_client.show_default_quota_set(
self.demo_tenant_id) self.demo_tenant_id)
new_quota_set = {'gigabytes': 1009, new_quota_set = {'gigabytes': 1009,
'volumes': 11, 'volumes': 11,
@@ -72,7 +72,7 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.attr(type='gate') @test.attr(type='gate')
@test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed') @test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
def test_show_quota_usage(self): def test_show_quota_usage(self):
quota_usage = self.quotas_client.get_quota_usage( quota_usage = self.quotas_client.show_quota_usage(
self.os_adm.credentials.tenant_id) self.os_adm.credentials.tenant_id)
for key in QUOTA_KEYS: for key in QUOTA_KEYS:
self.assertIn(key, quota_usage) self.assertIn(key, quota_usage)
@@ -82,14 +82,14 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
@test.attr(type='gate') @test.attr(type='gate')
@test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f') @test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')
def test_quota_usage(self): def test_quota_usage(self):
quota_usage = self.quotas_client.get_quota_usage( quota_usage = self.quotas_client.show_quota_usage(
self.demo_tenant_id) self.demo_tenant_id)
volume = self.create_volume() volume = self.create_volume()
self.addCleanup(self.admin_volume_client.delete_volume, self.addCleanup(self.admin_volume_client.delete_volume,
volume['id']) volume['id'])
new_quota_usage = self.quotas_client.get_quota_usage( new_quota_usage = self.quotas_client.show_quota_usage(
self.demo_tenant_id) self.demo_tenant_id)
self.assertEqual(quota_usage['volumes']['in_use'] + 1, self.assertEqual(quota_usage['volumes']['in_use'] + 1,
@@ -108,7 +108,7 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
tenant = identity_client.create_tenant(tenant_name) tenant = identity_client.create_tenant(tenant_name)
tenant_id = tenant['id'] tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id) self.addCleanup(identity_client.delete_tenant, tenant_id)
quota_set_default = self.quotas_client.get_default_quota_set( quota_set_default = self.quotas_client.show_default_quota_set(
tenant_id) tenant_id)
volume_default = quota_set_default['volumes'] volume_default = quota_set_default['volumes']
@@ -116,7 +116,7 @@ class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
volumes=(int(volume_default) + 5)) volumes=(int(volume_default) + 5))
self.quotas_client.delete_quota_set(tenant_id) self.quotas_client.delete_quota_set(tenant_id)
quota_set_new = self.quotas_client.get_quota_set(tenant_id) quota_set_new = self.quotas_client.show_quota_set(tenant_id)
self.assertEqual(volume_default, quota_set_new['volumes']) self.assertEqual(volume_default, quota_set_new['volumes'])

View File

@@ -77,7 +77,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
self.volumes_client.wait_for_volume_status(volume['id'], 'available') self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# Get volume details and Verify # Get volume details and Verify
fetched_volume = self.volumes_client.get_volume(volume['id']) fetched_volume = self.volumes_client.show_volume(volume['id'])
self.assertEqual(volume_types[1]['name'], self.assertEqual(volume_types[1]['name'],
fetched_volume['volume_type'], fetched_volume['volume_type'],
'The fetched Volume type is different ' 'The fetched Volume type is different '
@@ -110,7 +110,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
"to the requested name") "to the requested name")
self.assertTrue(body['id'] is not None, self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.") "Field volume_type id is empty or not found.")
fetched_volume_type = self.volume_types_client.get_volume_type( fetched_volume_type = self.volume_types_client.show_volume_type(
body['id']) body['id'])
self.assertEqual(name, fetched_volume_type['name'], self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different ' 'The fetched Volume_type is different '
@@ -146,7 +146,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
# Get encryption type # Get encryption type
fetched_encryption_type = ( fetched_encryption_type = (
self.volume_types_client.get_encryption_type( self.volume_types_client.show_encryption_type(
encryption_type['volume_type_id'])) encryption_type['volume_type_id']))
self.assertEqual(provider, self.assertEqual(provider,
fetched_encryption_type['provider'], fetched_encryption_type['provider'],
@@ -164,7 +164,7 @@ class VolumeTypesV2Test(base.BaseVolumeAdminTest):
"type": "encryption-type"} "type": "encryption-type"}
self.volume_types_client.wait_for_resource_deletion(resource) self.volume_types_client.wait_for_resource_deletion(resource)
deleted_encryption_type = ( deleted_encryption_type = (
self.volume_types_client.get_encryption_type( self.volume_types_client.show_encryption_type(
encryption_type['volume_type_id'])) encryption_type['volume_type_id']))
self.assertEmpty(deleted_encryption_type) self.assertEmpty(deleted_encryption_type)

View File

@@ -77,7 +77,7 @@ class VolumeTypesExtraSpecsV2Test(base.BaseVolumeAdminTest):
self.assertEqual(extra_specs, body, self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created") "Volume type extra spec incorrectly created")
self.volume_types_client.get_volume_type_extra_specs( self.volume_types_client.show_volume_type_extra_specs(
self.volume_type['id'], self.volume_type['id'],
extra_specs.keys()[0]) extra_specs.keys()[0])
self.assertEqual(extra_specs, body, self.assertEqual(extra_specs, body,

View File

@@ -137,7 +137,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
extra_specs = {"spec1": "val1"} extra_specs = {"spec1": "val1"}
self.assertRaises( self.assertRaises(
lib_exc.NotFound, lib_exc.NotFound,
self.volume_types_client.get_volume_type_extra_specs, self.volume_types_client.show_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs.keys()[0]) str(uuid.uuid4()), extra_specs.keys()[0])
@test.attr(type='gate') @test.attr(type='gate')
@@ -147,7 +147,7 @@ class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
# id. # id.
self.assertRaises( self.assertRaises(
lib_exc.NotFound, lib_exc.NotFound,
self.volume_types_client.get_volume_type_extra_specs, self.volume_types_client.show_volume_type_extra_specs,
self.volume_type['id'], str(uuid.uuid4())) self.volume_type['id'], str(uuid.uuid4()))

View File

@@ -45,7 +45,7 @@ class VolumeTypesNegativeV2Test(base.BaseVolumeAdminTest):
def test_get_nonexistent_type_id(self): def test_get_nonexistent_type_id(self):
# Should not be able to get volume type with nonexistent type id. # Should not be able to get volume type with nonexistent type id.
self.assertRaises(lib_exc.NotFound, self.assertRaises(lib_exc.NotFound,
self.volume_types_client.get_volume_type, self.volume_types_client.show_volume_type,
str(uuid.uuid4())) str(uuid.uuid4()))
@test.attr(type='gate') @test.attr(type='gate')

View File

@@ -79,7 +79,7 @@ class VolumesActionsV2Test(base.BaseVolumeAdminTest):
def test_volume_reset_status(self): def test_volume_reset_status(self):
# test volume reset status : available->error->available # test volume reset status : available->error->available
self._reset_volume_status(self.volume['id'], 'error') self._reset_volume_status(self.volume['id'], 'error')
volume_get = self.admin_volume_client.get_volume( volume_get = self.admin_volume_client.show_volume(
self.volume['id']) self.volume['id'])
self.assertEqual('error', volume_get['status']) self.assertEqual('error', volume_get['status'])

View File

@@ -55,11 +55,11 @@ class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
'available') 'available')
# Get a given backup # Get a given backup
backup = self.backups_adm_client.get_backup(backup['id']) backup = self.backups_adm_client.show_backup(backup['id'])
self.assertEqual(backup_name, backup['name']) self.assertEqual(backup_name, backup['name'])
# Get all backups with detail # Get all backups with detail
backups = self.backups_adm_client.list_backups_with_detail() backups = self.backups_adm_client.list_backups(detail=True)
self.assertIn((backup['name'], backup['id']), self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups]) [(m['name'], m['id']) for m in backups])

View File

@@ -32,7 +32,7 @@ class AvailabilityZoneV2TestJSON(base.BaseVolumeTest):
@test.idempotent_id('01f1ae88-eba9-4c6b-a011-6f7ace06b725') @test.idempotent_id('01f1ae88-eba9-4c6b-a011-6f7ace06b725')
def test_get_availability_zone_list(self): def test_get_availability_zone_list(self):
# List of availability zone # List of availability zone
availability_zone = self.client.get_availability_zone_list() availability_zone = self.client.list_availability_zones()
self.assertTrue(len(availability_zone) > 0) self.assertTrue(len(availability_zone) > 0)

View File

@@ -64,7 +64,7 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
self.created_qos['id'], vol_type_id) self.created_qos['id'], vol_type_id)
def _test_get_association_qos(self): def _test_get_association_qos(self):
body = self.volume_qos_client.get_association_qos( body = self.volume_qos_client.show_association_qos(
self.created_qos['id']) self.created_qos['id'])
associations = [] associations = []
@@ -102,7 +102,7 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
@test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd') @test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd')
def test_get_qos(self): def test_get_qos(self):
"""Tests the detail of a given qos-specs""" """Tests the detail of a given qos-specs"""
body = self.volume_qos_client.get_qos(self.created_qos['id']) body = self.volume_qos_client.show_qos(self.created_qos['id'])
self.assertEqual(self.qos_name, body['name']) self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer']) self.assertEqual(self.qos_consumer, body['consumer'])
@@ -121,7 +121,7 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
body = self.volume_qos_client.set_qos_key(self.created_qos['id'], body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
iops_bytes='500') iops_bytes='500')
self.assertEqual(args, body) self.assertEqual(args, body)
body = self.volume_qos_client.get_qos(self.created_qos['id']) body = self.volume_qos_client.show_qos(self.created_qos['id'])
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes']) self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs # test the deletion of a specs key from qos-specs
@@ -130,7 +130,7 @@ class QosSpecsV2TestJSON(base.BaseVolumeAdminTest):
operation = 'qos-key-unset' operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'], self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys) operation, keys)
body = self.volume_qos_client.get_qos(self.created_qos['id']) body = self.volume_qos_client.show_qos(self.created_qos['id'])
self.assertNotIn(keys[0], body['specs']) self.assertNotIn(keys[0], body['specs'])
@test.attr(type='smoke') @test.attr(type='smoke')

View File

@@ -50,12 +50,12 @@ class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
body = self.client.create_snapshot_metadata(self.snapshot_id, body = self.client.create_snapshot_metadata(self.snapshot_id,
metadata) metadata)
# Get the metadata of the snapshot # Get the metadata of the snapshot
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body) self.assertEqual(metadata, body)
# Delete one item metadata of the snapshot # Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item( self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1") self.snapshot_id, "key1")
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(expected, body) self.assertEqual(expected, body)
@test.attr(type='gate') @test.attr(type='gate')
@@ -71,13 +71,13 @@ class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
body = self.client.create_snapshot_metadata(self.snapshot_id, body = self.client.create_snapshot_metadata(self.snapshot_id,
metadata) metadata)
# Get the metadata of the snapshot # Get the metadata of the snapshot
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body) self.assertEqual(metadata, body)
# Update metadata item # Update metadata item
body = self.client.update_snapshot_metadata( body = self.client.update_snapshot_metadata(
self.snapshot_id, update) self.snapshot_id, update)
# Get the metadata of the snapshot # Get the metadata of the snapshot
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(update, body) self.assertEqual(update, body)
@test.attr(type='gate') @test.attr(type='gate')
@@ -95,13 +95,13 @@ class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
body = self.client.create_snapshot_metadata(self.snapshot_id, body = self.client.create_snapshot_metadata(self.snapshot_id,
metadata) metadata)
# Get the metadata of the snapshot # Get the metadata of the snapshot
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body) self.assertEqual(metadata, body)
# Update metadata item # Update metadata item
body = self.client.update_snapshot_metadata_item( body = self.client.update_snapshot_metadata_item(
self.snapshot_id, "key3", update_item) self.snapshot_id, "key3", update_item)
# Get the metadata of the snapshot # Get the metadata of the snapshot
body = self.client.get_snapshot_metadata(self.snapshot_id) body = self.client.show_snapshot_metadata(self.snapshot_id)
self.assertEqual(expect, body) self.assertEqual(expect, body)

View File

@@ -45,12 +45,12 @@ class VolumesV2MetadataTest(base.BaseVolumeTest):
body = self.volumes_client.create_volume_metadata(self.volume_id, body = self.volumes_client.create_volume_metadata(self.volume_id,
metadata) metadata)
# Get the metadata of the volume # Get the metadata of the volume
body = self.volumes_client.get_volume_metadata(self.volume_id) body = self.volumes_client.show_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items())) self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the volume # Delete one item metadata of the volume
self.volumes_client.delete_volume_metadata_item( self.volumes_client.delete_volume_metadata_item(
self.volume_id, "key1") self.volume_id, "key1")
body = self.volumes_client.get_volume_metadata(self.volume_id) body = self.volumes_client.show_volume_metadata(self.volume_id)
self.assertNotIn("key1", body) self.assertNotIn("key1", body)
del metadata["key1"] del metadata["key1"]
self.assertThat(body.items(), matchers.ContainsAll(metadata.items())) self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
@@ -70,13 +70,13 @@ class VolumesV2MetadataTest(base.BaseVolumeTest):
body = self.volumes_client.create_volume_metadata( body = self.volumes_client.create_volume_metadata(
self.volume_id, metadata) self.volume_id, metadata)
# Get the metadata of the volume # Get the metadata of the volume
body = self.volumes_client.get_volume_metadata(self.volume_id) body = self.volumes_client.show_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items())) self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata # Update metadata
body = self.volumes_client.update_volume_metadata( body = self.volumes_client.update_volume_metadata(
self.volume_id, update) self.volume_id, update)
# Get the metadata of the volume # Get the metadata of the volume
body = self.volumes_client.get_volume_metadata(self.volume_id) body = self.volumes_client.show_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(update.items())) self.assertThat(body.items(), matchers.ContainsAll(update.items()))
@test.attr(type='gate') @test.attr(type='gate')
@@ -98,7 +98,7 @@ class VolumesV2MetadataTest(base.BaseVolumeTest):
body = self.volumes_client.update_volume_metadata_item( body = self.volumes_client.update_volume_metadata_item(
self.volume_id, "key3", update_item) self.volume_id, "key3", update_item)
# Get the metadata of the volume # Get the metadata of the volume
body = self.volumes_client.get_volume_metadata(self.volume_id) body = self.volumes_client.show_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(expect.items())) self.assertThat(body.items(), matchers.ContainsAll(expect.items()))

View File

@@ -71,7 +71,7 @@ class VolumesV2TransfersTest(base.BaseVolumeTest):
'awaiting-transfer') 'awaiting-transfer')
# Get a volume transfer # Get a volume transfer
body = self.client.get_volume_transfer(transfer_id) body = self.client.show_volume_transfer(transfer_id)
self.assertEqual(volume['id'], body['volume_id']) self.assertEqual(volume['id'], body['volume_id'])
# List volume transfers, the result should be greater than # List volume transfers, the result should be greater than

View File

@@ -86,7 +86,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
self.volume['id'], self.volume['id'],
'available') 'available')
self.addCleanup(self.client.detach_volume, self.volume['id']) self.addCleanup(self.client.detach_volume, self.volume['id'])
volume = self.client.get_volume(self.volume['id']) volume = self.client.show_volume(self.volume['id'])
self.assertIn('attachments', volume) self.assertIn('attachments', volume)
attachment = self.client.get_attachment_from_volume(volume) attachment = self.client.get_attachment_from_volume(volume)
self.assertEqual(mountpoint, attachment['device']) self.assertEqual(mountpoint, attachment['device'])
@@ -117,12 +117,12 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
# Mark volume as reserved. # Mark volume as reserved.
body = self.client.reserve_volume(self.volume['id']) body = self.client.reserve_volume(self.volume['id'])
# To get the volume info # To get the volume info
body = self.client.get_volume(self.volume['id']) body = self.client.show_volume(self.volume['id'])
self.assertIn('attaching', body['status']) self.assertIn('attaching', body['status'])
# Unmark volume as reserved. # Unmark volume as reserved.
body = self.client.unreserve_volume(self.volume['id']) body = self.client.unreserve_volume(self.volume['id'])
# To get the volume info # To get the volume info
body = self.client.get_volume(self.volume['id']) body = self.client.show_volume(self.volume['id'])
self.assertIn('available', body['status']) self.assertIn('available', body['status'])
def _is_true(self, val): def _is_true(self, val):
@@ -136,7 +136,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
self.client.update_volume_readonly(self.volume['id'], self.client.update_volume_readonly(self.volume['id'],
readonly) readonly)
# Get Volume information # Get Volume information
fetched_volume = self.client.get_volume(self.volume['id']) fetched_volume = self.client.show_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly']) bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(True, bool_flag) self.assertEqual(True, bool_flag)
@@ -145,7 +145,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
self.client.update_volume_readonly(self.volume['id'], readonly) self.client.update_volume_readonly(self.volume['id'], readonly)
# Get Volume information # Get Volume information
fetched_volume = self.client.get_volume(self.volume['id']) fetched_volume = self.client.show_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly']) bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(False, bool_flag) self.assertEqual(False, bool_flag)

View File

@@ -35,7 +35,7 @@ class VolumesV2ExtendTest(base.BaseVolumeTest):
extend_size = int(self.volume['size']) + 1 extend_size = int(self.volume['size']) + 1
self.client.extend_volume(self.volume['id'], extend_size) self.client.extend_volume(self.volume['id'], extend_size)
self.client.wait_for_volume_status(self.volume['id'], 'available') self.client.wait_for_volume_status(self.volume['id'], 'available')
volume = self.client.get_volume(self.volume['id']) volume = self.client.show_volume(self.volume['id'])
self.assertEqual(int(volume['size']), extend_size) self.assertEqual(int(volume['size']), extend_size)

View File

@@ -60,7 +60,7 @@ class VolumesV2GetTest(base.BaseVolumeTest):
self.assertTrue(volume['id'] is not None, self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.") "Field volume id is empty or not found.")
# Get Volume information # Get Volume information
fetched_volume = self.client.get_volume(volume['id']) fetched_volume = self.client.show_volume(volume['id'])
self.assertEqual(v_name, self.assertEqual(v_name,
fetched_volume[self.name_field], fetched_volume[self.name_field],
'The fetched Volume name is different ' 'The fetched Volume name is different '
@@ -92,8 +92,8 @@ class VolumesV2GetTest(base.BaseVolumeTest):
# Assert response body for update_volume method # Assert response body for update_volume method
self.assertEqual(new_v_name, update_volume[self.name_field]) self.assertEqual(new_v_name, update_volume[self.name_field])
self.assertEqual(new_desc, update_volume[self.descrip_field]) self.assertEqual(new_desc, update_volume[self.descrip_field])
# Assert response body for get_volume method # Assert response body for show_volume method
updated_volume = self.client.get_volume(volume['id']) updated_volume = self.client.show_volume(volume['id'])
self.assertEqual(volume['id'], updated_volume['id']) self.assertEqual(volume['id'], updated_volume['id'])
self.assertEqual(new_v_name, updated_volume[self.name_field]) self.assertEqual(new_v_name, updated_volume[self.name_field])
self.assertEqual(new_desc, updated_volume[self.descrip_field]) self.assertEqual(new_desc, updated_volume[self.descrip_field])

View File

@@ -70,7 +70,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
cls.metadata = {'Type': 'work'} cls.metadata = {'Type': 'work'}
for i in range(3): for i in range(3):
volume = cls.create_volume(metadata=cls.metadata) volume = cls.create_volume(metadata=cls.metadata)
volume = cls.client.get_volume(volume['id']) volume = cls.client.show_volume(volume['id'])
cls.volume_list.append(volume) cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id']) cls.volume_id_list.append(volume['id'])
@@ -89,7 +89,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
""" """
if with_detail: if with_detail:
fetched_vol_list = \ fetched_vol_list = \
self.client.list_volumes_with_detail(params=params) self.client.list_volumes(detail=True, params=params)
else: else:
fetched_vol_list = self.client.list_volumes(params=params) fetched_vol_list = self.client.list_volumes(params=params)
@@ -125,7 +125,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
def test_volume_list_with_details(self): def test_volume_list_with_details(self):
# Get a list of Volumes with details # Get a list of Volumes with details
# Fetch all Volumes # Fetch all Volumes
fetched_list = self.client.list_volumes_with_detail() fetched_list = self.client.list_volumes(detail=True)
self.assertVolumesIn(fetched_list, self.volume_list) self.assertVolumesIn(fetched_list, self.volume_list)
@test.attr(type='gate') @test.attr(type='gate')
@@ -133,7 +133,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
def test_volume_list_by_name(self): def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)] volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]} params = {self.name: volume[self.name]}
fetched_vol = self.client.list_volumes(params) fetched_vol = self.client.list_volumes(params=params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol)) self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name], self.assertEqual(fetched_vol[0][self.name],
volume[self.name]) volume[self.name])
@@ -143,7 +143,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
def test_volume_list_details_by_name(self): def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)] volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]} params = {self.name: volume[self.name]}
fetched_vol = self.client.list_volumes_with_detail(params) fetched_vol = self.client.list_volumes(detail=True, params=params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol)) self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name], self.assertEqual(fetched_vol[0][self.name],
volume[self.name]) volume[self.name])
@@ -152,7 +152,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
@test.idempotent_id('39654e13-734c-4dab-95ce-7613bf8407ce') @test.idempotent_id('39654e13-734c-4dab-95ce-7613bf8407ce')
def test_volumes_list_by_status(self): def test_volumes_list_by_status(self):
params = {'status': 'available'} params = {'status': 'available'}
fetched_list = self.client.list_volumes(params) fetched_list = self.client.list_volumes(params=params)
self._list_by_param_value_and_assert(params) self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list, self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS) fields=self.VOLUME_FIELDS)
@@ -161,7 +161,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
@test.idempotent_id('2943f712-71ec-482a-bf49-d5ca06216b9f') @test.idempotent_id('2943f712-71ec-482a-bf49-d5ca06216b9f')
def test_volumes_list_details_by_status(self): def test_volumes_list_details_by_status(self):
params = {'status': 'available'} params = {'status': 'available'}
fetched_list = self.client.list_volumes_with_detail(params) fetched_list = self.client.list_volumes(detail=True, params=params)
for volume in fetched_list: for volume in fetched_list:
self.assertEqual('available', volume['status']) self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list) self.assertVolumesIn(fetched_list, self.volume_list)
@@ -172,7 +172,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
volume = self.volume_list[data_utils.rand_int_id(0, 2)] volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone'] zone = volume['availability_zone']
params = {'availability_zone': zone} params = {'availability_zone': zone}
fetched_list = self.client.list_volumes(params) fetched_list = self.client.list_volumes(params=params)
self._list_by_param_value_and_assert(params) self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list, self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS) fields=self.VOLUME_FIELDS)
@@ -183,7 +183,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
volume = self.volume_list[data_utils.rand_int_id(0, 2)] volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone'] zone = volume['availability_zone']
params = {'availability_zone': zone} params = {'availability_zone': zone}
fetched_list = self.client.list_volumes_with_detail(params) fetched_list = self.client.list_volumes(detail=True, params=params)
for volume in fetched_list: for volume in fetched_list:
self.assertEqual(zone, volume['availability_zone']) self.assertEqual(zone, volume['availability_zone'])
self.assertVolumesIn(fetched_list, self.volume_list) self.assertVolumesIn(fetched_list, self.volume_list)

View File

@@ -43,7 +43,7 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
@test.idempotent_id('f131c586-9448-44a4-a8b0-54ca838aa43e') @test.idempotent_id('f131c586-9448-44a4-a8b0-54ca838aa43e')
def test_volume_get_nonexistent_volume_id(self): def test_volume_get_nonexistent_volume_id(self):
# Should not be able to get a non-existent volume # Should not be able to get a non-existent volume
self.assertRaises(lib_exc.NotFound, self.client.get_volume, self.assertRaises(lib_exc.NotFound, self.client.show_volume,
str(uuid.uuid4())) str(uuid.uuid4()))
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@@ -152,14 +152,14 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
@test.idempotent_id('30799cfd-7ee4-446c-b66c-45b383ed211b') @test.idempotent_id('30799cfd-7ee4-446c-b66c-45b383ed211b')
def test_get_invalid_volume_id(self): def test_get_invalid_volume_id(self):
# Should not be able to get volume with invalid id # Should not be able to get volume with invalid id
self.assertRaises(lib_exc.NotFound, self.client.get_volume, self.assertRaises(lib_exc.NotFound, self.client.show_volume,
'#$%%&^&^') '#$%%&^&^')
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@test.idempotent_id('c6c3db06-29ad-4e91-beb0-2ab195fe49e3') @test.idempotent_id('c6c3db06-29ad-4e91-beb0-2ab195fe49e3')
def test_get_volume_without_passing_volume_id(self): def test_get_volume_without_passing_volume_id(self):
# Should not be able to get volume when empty ID is passed # Should not be able to get volume when empty ID is passed
self.assertRaises(lib_exc.NotFound, self.client.get_volume, '') self.assertRaises(lib_exc.NotFound, self.client.show_volume, '')
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@test.idempotent_id('1f035827-7c32-4019-9240-b4ec2dbd9dfd') @test.idempotent_id('1f035827-7c32-4019-9240-b4ec2dbd9dfd')
@@ -266,7 +266,7 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
def test_list_volumes_with_nonexistent_name(self): def test_list_volumes_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume') v_name = data_utils.rand_name('Volume')
params = {self.name_field: v_name} params = {self.name_field: v_name}
fetched_volume = self.client.list_volumes(params) fetched_volume = self.client.list_volumes(params=params)
self.assertEqual(0, len(fetched_volume)) self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@@ -275,14 +275,14 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
v_name = data_utils.rand_name('Volume') v_name = data_utils.rand_name('Volume')
params = {self.name_field: v_name} params = {self.name_field: v_name}
fetched_volume = \ fetched_volume = \
self.client.list_volumes_with_detail(params) self.client.list_volumes(detail=True, params=params)
self.assertEqual(0, len(fetched_volume)) self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@test.idempotent_id('143b279b-7522-466b-81be-34a87d564a7c') @test.idempotent_id('143b279b-7522-466b-81be-34a87d564a7c')
def test_list_volumes_with_invalid_status(self): def test_list_volumes_with_invalid_status(self):
params = {'status': 'null'} params = {'status': 'null'}
fetched_volume = self.client.list_volumes(params) fetched_volume = self.client.list_volumes(params=params)
self.assertEqual(0, len(fetched_volume)) self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
@@ -290,7 +290,7 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
def test_list_volumes_detail_with_invalid_status(self): def test_list_volumes_detail_with_invalid_status(self):
params = {'status': 'null'} params = {'status': 'null'}
fetched_volume = \ fetched_volume = \
self.client.list_volumes_with_detail(params) self.client.list_volumes(detail=True, params=params)
self.assertEqual(0, len(fetched_volume)) self.assertEqual(0, len(fetched_volume))

View File

@@ -50,7 +50,7 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
if with_detail: if with_detail:
fetched_snap_list = \ fetched_snap_list = \
self.snapshots_client.\ self.snapshots_client.\
list_snapshots_with_detail(params=params) list_snapshots(detail=True, params=params)
else: else:
fetched_snap_list = \ fetched_snap_list = \
self.snapshots_client.list_snapshots(params=params) self.snapshots_client.list_snapshots(params=params)
@@ -98,7 +98,7 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
snapshot = self.create_snapshot(self.volume_origin['id'], **params) snapshot = self.create_snapshot(self.volume_origin['id'], **params)
# Get the snap and check for some of its details # Get the snap and check for some of its details
snap_get = self.snapshots_client.get_snapshot(snapshot['id']) snap_get = self.snapshots_client.show_snapshot(snapshot['id'])
self.assertEqual(self.volume_origin['id'], self.assertEqual(self.volume_origin['id'],
snap_get['volume_id'], snap_get['volume_id'],
"Referred volume origin mismatch") "Referred volume origin mismatch")
@@ -119,9 +119,9 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
# Assert response body for update_snapshot method # Assert response body for update_snapshot method
self.assertEqual(new_s_name, update_snapshot[self.name_field]) self.assertEqual(new_s_name, update_snapshot[self.name_field])
self.assertEqual(new_desc, update_snapshot[self.descrip_field]) self.assertEqual(new_desc, update_snapshot[self.descrip_field])
# Assert response body for get_snapshot method # Assert response body for show_snapshot method
updated_snapshot = \ updated_snapshot = \
self.snapshots_client.get_snapshot(snapshot['id']) self.snapshots_client.show_snapshot(snapshot['id'])
self.assertEqual(new_s_name, updated_snapshot[self.name_field]) self.assertEqual(new_s_name, updated_snapshot[self.name_field])
self.assertEqual(new_desc, updated_snapshot[self.descrip_field]) self.assertEqual(new_desc, updated_snapshot[self.descrip_field])

View File

@@ -45,7 +45,7 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
cls.metadata = {'Type': 'work'} cls.metadata = {'Type': 'work'}
for i in range(3): for i in range(3):
volume = cls.create_volume(metadata=cls.metadata) volume = cls.create_volume(metadata=cls.metadata)
volume = cls.client.get_volume(volume['id']) volume = cls.client.show_volume(volume['id'])
cls.volume_list.append(volume) cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id']) cls.volume_id_list.append(volume['id'])
@@ -70,7 +70,8 @@ class VolumesV2ListTestJSON(base.BaseVolumeTest):
'sort_dir': sort_dir, 'sort_dir': sort_dir,
'sort_key': sort_key 'sort_key': sort_key
} }
fetched_volume = self.client.list_volumes_with_detail(params) fetched_volume = self.client.list_volumes(detail=True,
params=params)
self.assertEqual(limit, len(fetched_volume), self.assertEqual(limit, len(fetched_volume),
"The count of volumes is %s, expected:%s " % "The count of volumes is %s, expected:%s " %
(len(fetched_volume), limit)) (len(fetched_volume), limit))

View File

@@ -234,7 +234,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
self.volumes_client.wait_for_volume_status(volume['id'], 'available') self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# The volume retrieved on creation has a non-up-to-date status. # The volume retrieved on creation has a non-up-to-date status.
# Retrieval after it becomes active ensures correct details. # Retrieval after it becomes active ensures correct details.
volume = self.volumes_client.get_volume(volume['id']) volume = self.volumes_client.show_volume(volume['id'])
return volume return volume
def _create_loginable_secgroup_rule(self, secgroup_id=None): def _create_loginable_secgroup_rule(self, secgroup_id=None):
@@ -425,14 +425,14 @@ class ScenarioTest(tempest.test.BaseTestCase):
self.assertEqual(self.volume['id'], volume['id']) self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use') self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment # Refresh the volume after the attachment
self.volume = self.volumes_client.get_volume(volume['id']) self.volume = self.volumes_client.show_volume(volume['id'])
def nova_volume_detach(self): def nova_volume_detach(self):
self.servers_client.detach_volume(self.server['id'], self.volume['id']) self.servers_client.detach_volume(self.server['id'], self.volume['id'])
self.volumes_client.wait_for_volume_status(self.volume['id'], self.volumes_client.wait_for_volume_status(self.volume['id'],
'available') 'available')
volume = self.volumes_client.get_volume(self.volume['id']) volume = self.volumes_client.show_volume(self.volume['id'])
self.assertEqual('available', volume['status']) self.assertEqual('available', volume['status'])
def rebuild_server(self, server_id, image=None, def rebuild_server(self, server_id, image=None,

View File

@@ -73,7 +73,7 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
self.assertIn(self.volume['id'], [x['id'] for x in volumes]) self.assertIn(self.volume['id'], [x['id'] for x in volumes])
def cinder_show(self): def cinder_show(self):
volume = self.volumes_client.get_volume(self.volume['id']) volume = self.volumes_client.show_volume(self.volume['id'])
self.assertEqual(self.volume, volume) self.assertEqual(self.volume, volume)
def nova_volume_attach(self): def nova_volume_attach(self):
@@ -83,7 +83,7 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
self.assertEqual(self.volume['id'], volume['id']) self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use') self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment # Refresh the volume after the attachment
self.volume = self.volumes_client.get_volume(volume['id']) self.volume = self.volumes_client.show_volume(volume['id'])
def nova_reboot(self): def nova_reboot(self):
self.servers_client.reboot(self.server['id'], 'SOFT') self.servers_client.reboot(self.server['id'], 'SOFT')
@@ -99,7 +99,7 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
self.volumes_client.wait_for_volume_status(self.volume['id'], self.volumes_client.wait_for_volume_status(self.volume['id'],
'available') 'available')
volume = self.volumes_client.get_volume(self.volume['id']) volume = self.volumes_client.show_volume(self.volume['id'])
self.assertEqual('available', volume['status']) self.assertEqual('available', volume['status'])
def create_and_add_security_group(self): def create_and_add_security_group(self):

View File

@@ -85,7 +85,7 @@ class TestStampPattern(manager.ScenarioTest):
def cleaner(): def cleaner():
self.snapshots_client.delete_snapshot(snapshot['id']) self.snapshots_client.delete_snapshot(snapshot['id'])
try: try:
while self.snapshots_client.get_snapshot(snapshot['id']): while self.snapshots_client.show_snapshot(snapshot['id']):
time.sleep(1) time.sleep(1)
except lib_exc.NotFound: except lib_exc.NotFound:
pass pass

View File

@@ -26,7 +26,7 @@ class BaseVolumeQuotasClientJSON(service_client.ServiceClient):
TYPE = "json" TYPE = "json"
def get_default_quota_set(self, tenant_id): def show_default_quota_set(self, tenant_id):
"""List the default volume quota set for a tenant.""" """List the default volume quota set for a tenant."""
url = 'os-quota-sets/%s/defaults' % tenant_id url = 'os-quota-sets/%s/defaults' % tenant_id
@@ -34,7 +34,7 @@ class BaseVolumeQuotasClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, self._parse_resp(body)) return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_set(self, tenant_id, params=None): def show_quota_set(self, tenant_id, params=None):
"""List the quota set for a tenant.""" """List the quota set for a tenant."""
url = 'os-quota-sets/%s' % tenant_id url = 'os-quota-sets/%s' % tenant_id
@@ -45,10 +45,10 @@ class BaseVolumeQuotasClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, self._parse_resp(body)) return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_usage(self, tenant_id): def show_quota_usage(self, tenant_id):
"""List the quota set for a tenant.""" """List the quota set for a tenant."""
body = self.get_quota_set(tenant_id, params={'usage': True}) body = self.show_quota_set(tenant_id, params={'usage': True})
return body return body
def update_quota_set(self, tenant_id, gigabytes=None, volumes=None, def update_quota_set(self, tenant_id, gigabytes=None, volumes=None,

View File

@@ -33,9 +33,9 @@ class BaseVolumeTypesClientJSON(service_client.ServiceClient):
# "type": resource_type} # "type": resource_type}
try: try:
if resource['type'] == "volume-type": if resource['type'] == "volume-type":
self.get_volume_type(resource['id']) self.show_volume_type(resource['id'])
elif resource['type'] == "encryption-type": elif resource['type'] == "encryption-type":
body = self.get_encryption_type(resource['id']) body = self.show_encryption_type(resource['id'])
if not body: if not body:
return True return True
else: else:
@@ -61,7 +61,7 @@ class BaseVolumeTypesClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['volume_types']) return service_client.ResponseBodyList(resp, body['volume_types'])
def get_volume_type(self, volume_id): def show_volume_type(self, volume_id):
"""Returns the details of a single volume_type.""" """Returns the details of a single volume_type."""
url = "types/%s" % str(volume_id) url = "types/%s" % str(volume_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -104,7 +104,7 @@ class BaseVolumeTypesClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body['extra_specs']) return service_client.ResponseBody(resp, body['extra_specs'])
def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name): def show_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
"""Returns the details of a single volume_type extra spec.""" """Returns the details of a single volume_type extra spec."""
url = "types/%s/extra_specs/%s" % (str(vol_type_id), url = "types/%s/extra_specs/%s" % (str(vol_type_id),
str(extra_spec_name)) str(extra_spec_name))
@@ -150,7 +150,7 @@ class BaseVolumeTypesClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def get_encryption_type(self, vol_type_id): def show_encryption_type(self, vol_type_id):
""" """
Get the volume encryption type for the specified volume type. Get the volume encryption type for the specified volume type.
vol_type_id: Id of volume_type. vol_type_id: Id of volume_type.

View File

@@ -20,7 +20,7 @@ from tempest.common import service_client
class BaseVolumeAvailabilityZoneClientJSON(service_client.ServiceClient): class BaseVolumeAvailabilityZoneClientJSON(service_client.ServiceClient):
def get_availability_zone_list(self): def list_availability_zones(self):
resp, body = self.get('os-availability-zone') resp, body = self.get('os-availability-zone')
body = json.loads(body) body = json.loads(body)
self.expected_success(200, resp.status) self.expected_success(200, resp.status)

View File

@@ -56,7 +56,7 @@ class BaseBackupsClientJSON(service_client.ServiceClient):
self.expected_success(202, resp.status) self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def get_backup(self, backup_id): def show_backup(self, backup_id):
"""Returns the details of a single backup.""" """Returns the details of a single backup."""
url = "backups/%s" % str(backup_id) url = "backups/%s" % str(backup_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -64,9 +64,11 @@ class BaseBackupsClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body['backup']) return service_client.ResponseBody(resp, body['backup'])
def list_backups_with_detail(self): def list_backups(self, detail=False):
"""Information for all the tenant's backups.""" """Information for all the tenant's backups."""
url = "backups/detail" url = "backups"
if detail:
url += "/detail"
resp, body = self.get(url) resp, body = self.get(url)
body = json.loads(body) body = json.loads(body)
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
@@ -74,13 +76,13 @@ class BaseBackupsClientJSON(service_client.ServiceClient):
def wait_for_backup_status(self, backup_id, status): def wait_for_backup_status(self, backup_id, status):
"""Waits for a Backup to reach a given status.""" """Waits for a Backup to reach a given status."""
body = self.get_backup(backup_id) body = self.show_backup(backup_id)
backup_status = body['status'] backup_status = body['status']
start = int(time.time()) start = int(time.time())
while backup_status != status: while backup_status != status:
time.sleep(self.build_interval) time.sleep(self.build_interval)
body = self.get_backup(backup_id) body = self.show_backup(backup_id)
backup_status = body['status'] backup_status = body['status']
if backup_status == 'error': if backup_status == 'error':
raise exceptions.VolumeBackupException(backup_id=backup_id) raise exceptions.VolumeBackupException(backup_id=backup_id)

View File

@@ -26,7 +26,7 @@ class BaseQosSpecsClientJSON(service_client.ServiceClient):
def is_resource_deleted(self, qos_id): def is_resource_deleted(self, qos_id):
try: try:
self.get_qos(qos_id) self.show_qos(qos_id)
except lib_exc.NotFound: except lib_exc.NotFound:
return True return True
return False return False
@@ -48,15 +48,15 @@ class BaseQosSpecsClientJSON(service_client.ServiceClient):
start_time = int(time.time()) start_time = int(time.time())
while True: while True:
if operation == 'qos-key-unset': if operation == 'qos-key-unset':
body = self.get_qos(qos_id) body = self.show_qos(qos_id)
if not any(key in body['specs'] for key in args): if not any(key in body['specs'] for key in args):
return return
elif operation == 'disassociate': elif operation == 'disassociate':
body = self.get_association_qos(qos_id) body = self.show_association_qos(qos_id)
if not any(args in body[i]['id'] for i in range(0, len(body))): if not any(args in body[i]['id'] for i in range(0, len(body))):
return return
elif operation == 'disassociate-all': elif operation == 'disassociate-all':
body = self.get_association_qos(qos_id) body = self.show_association_qos(qos_id)
if not body: if not body:
return return
else: else:
@@ -96,7 +96,7 @@ class BaseQosSpecsClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['qos_specs']) return service_client.ResponseBodyList(resp, body['qos_specs'])
def get_qos(self, qos_id): def show_qos(self, qos_id):
"""Get the specified QoS specification.""" """Get the specified QoS specification."""
url = "qos-specs/%s" % str(qos_id) url = "qos-specs/%s" % str(qos_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -133,7 +133,7 @@ class BaseQosSpecsClientJSON(service_client.ServiceClient):
self.expected_success(202, resp.status) self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def get_association_qos(self, qos_id): def show_association_qos(self, qos_id):
"""Get the association of the specified QoS specification.""" """Get the association of the specified QoS specification."""
url = "qos-specs/%s/associations" % str(qos_id) url = "qos-specs/%s/associations" % str(qos_id)
resp, body = self.get(url) resp, body = self.get(url)

View File

@@ -29,29 +29,20 @@ class BaseSnapshotsClientJSON(service_client.ServiceClient):
create_resp = 200 create_resp = 200
def list_snapshots(self, params=None): def list_snapshots(self, detail=False, params=None):
"""List all the snapshot.""" """List all the snapshot."""
url = 'snapshots' url = 'snapshots'
if detail:
url += '/detail'
if params: if params:
url += '?%s' % urllib.urlencode(params) url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url) resp, body = self.get(url)
body = json.loads(body) body = json.loads(body)
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['snapshots']) return service_client.ResponseBodyList(resp, body['snapshots'])
def list_snapshots_with_detail(self, params=None): def show_snapshot(self, snapshot_id):
"""List the details of all snapshots."""
url = 'snapshots/detail'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['snapshots'])
def get_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot.""" """Returns the details of a single snapshot."""
url = "snapshots/%s" % str(snapshot_id) url = "snapshots/%s" % str(snapshot_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -85,7 +76,7 @@ class BaseSnapshotsClientJSON(service_client.ServiceClient):
# NOTE(afazekas): just for the wait function # NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id): def _get_snapshot_status(self, snapshot_id):
body = self.get_snapshot(snapshot_id) body = self.show_snapshot(snapshot_id)
status = body['status'] status = body['status']
# NOTE(afazekas): snapshot can reach an "error" # NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle # state in a "normal" lifecycle
@@ -128,7 +119,7 @@ class BaseSnapshotsClientJSON(service_client.ServiceClient):
def is_resource_deleted(self, id): def is_resource_deleted(self, id):
try: try:
self.get_snapshot(id) self.show_snapshot(id)
except lib_exc.NotFound: except lib_exc.NotFound:
return True return True
return False return False
@@ -166,7 +157,7 @@ class BaseSnapshotsClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body['metadata']) return service_client.ResponseBody(resp, body['metadata'])
def get_snapshot_metadata(self, snapshot_id): def show_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot.""" """Get metadata of the snapshot."""
url = "snapshots/%s/metadata" % str(snapshot_id) url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.get(url) resp, body = self.get(url)

View File

@@ -40,29 +40,20 @@ class BaseVolumesClientJSON(service_client.ServiceClient):
"""Return the element 'attachment' from input volumes.""" """Return the element 'attachment' from input volumes."""
return volume['attachments'][0] return volume['attachments'][0]
def list_volumes(self, params=None): def list_volumes(self, detail=False, params=None):
"""List all the volumes created.""" """List all the volumes created."""
url = 'volumes' url = 'volumes'
if detail:
url += '/detail'
if params: if params:
url += '?%s' % urllib.urlencode(params) url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url) resp, body = self.get(url)
body = json.loads(body) body = json.loads(body)
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['volumes']) return service_client.ResponseBodyList(resp, body['volumes'])
def list_volumes_with_detail(self, params=None): def show_volume(self, volume_id):
"""List the details of all volumes."""
url = 'volumes/detail'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBodyList(resp, body['volumes'])
def get_volume(self, volume_id):
"""Returns the details of a single volume.""" """Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id) url = "volumes/%s" % str(volume_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -161,13 +152,13 @@ class BaseVolumesClientJSON(service_client.ServiceClient):
def wait_for_volume_status(self, volume_id, status): def wait_for_volume_status(self, volume_id, status):
"""Waits for a Volume to reach a given status.""" """Waits for a Volume to reach a given status."""
body = self.get_volume(volume_id) body = self.show_volume(volume_id)
volume_status = body['status'] volume_status = body['status']
start = int(time.time()) start = int(time.time())
while volume_status != status: while volume_status != status:
time.sleep(self.build_interval) time.sleep(self.build_interval)
body = self.get_volume(volume_id) body = self.show_volume(volume_id)
volume_status = body['status'] volume_status = body['status']
if volume_status == 'error': if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id) raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
@@ -183,7 +174,7 @@ class BaseVolumesClientJSON(service_client.ServiceClient):
def is_resource_deleted(self, id): def is_resource_deleted(self, id):
try: try:
self.get_volume(id) self.show_volume(id)
except lib_exc.NotFound: except lib_exc.NotFound:
return True return True
return False return False
@@ -240,7 +231,7 @@ class BaseVolumesClientJSON(service_client.ServiceClient):
self.expected_success(202, resp.status) self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body['transfer']) return service_client.ResponseBody(resp, body['transfer'])
def get_volume_transfer(self, transfer_id): def show_volume_transfer(self, transfer_id):
"""Returns the details of a volume transfer.""" """Returns the details of a volume transfer."""
url = "os-volume-transfer/%s" % str(transfer_id) url = "os-volume-transfer/%s" % str(transfer_id)
resp, body = self.get(url) resp, body = self.get(url)
@@ -303,7 +294,7 @@ class BaseVolumesClientJSON(service_client.ServiceClient):
self.expected_success(200, resp.status) self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body['metadata']) return service_client.ResponseBody(resp, body['metadata'])
def get_volume_metadata(self, volume_id): def show_volume_metadata(self, volume_id):
"""Get metadata of the volume.""" """Get metadata of the volume."""
url = "volumes/%s/metadata" % str(volume_id) url = "volumes/%s/metadata" % str(volume_id)
resp, body = self.get(url) resp, body = self.get(url)

View File

@@ -80,7 +80,7 @@ def cleanup():
# volume deletion may block # volume deletion may block
_, snaps = admin_manager.snapshots_client.\ _, snaps = admin_manager.snapshots_client.\
list_snapshots({"all_tenants": True}) list_snapshots(params={"all_tenants": True})
LOG.info("Cleanup::remove %s snapshots" % len(snaps)) LOG.info("Cleanup::remove %s snapshots" % len(snaps))
for v in snaps: for v in snaps:
try: try:
@@ -96,7 +96,8 @@ def cleanup():
except Exception: except Exception:
pass pass
vols = admin_manager.volumes_client.list_volumes({"all_tenants": True}) vols = admin_manager.volumes_client.list_volumes(
params={"all_tenants": True})
LOG.info("Cleanup::remove %s volumes" % len(vols)) LOG.info("Cleanup::remove %s volumes" % len(vols))
for v in vols: for v in vols:
try: try: