Make volume client alias with _latest suffix

This is next step patch from https://review.openstack.org/#/c/573118/
which makes all the volume service clients alias with _latest suffix.

As all the volume clients point to v3 service client only, having
alias with _v2_ or _v3_ name are confusing.

This commit provide alias with _latest suffix and use them in
tempest. As old alias are being used in tempest plugins also,
we keep the old alias also and slowly will move each plugins to
start using new alias.

Change-Id: Ib89ab72ab4ada3e8442901f104b0b96072187ef9
This commit is contained in:
ghanshyam 2018-08-06 09:54:45 +00:00 committed by Ghanshyam Mann
parent 127d2970dc
commit 6c682ffc5d
8 changed files with 87 additions and 60 deletions

View File

@ -38,8 +38,8 @@ class BaseVolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
@classmethod
def setup_clients(cls):
super(BaseVolumeQuotasAdminTestJSON, cls).setup_clients()
cls.transfer_client = cls.os_primary.volume_transfers_v2_client
cls.alt_transfer_client = cls.os_alt.volume_transfers_v2_client
cls.transfer_client = cls.os_primary.volume_transfers_client_latest
cls.alt_transfer_client = cls.os_alt.volume_transfers_client_latest
@classmethod
def resource_setup(cls):

View File

@ -74,24 +74,19 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
if CONF.service_available.glance:
cls.images_client = cls.os_primary.image_client_v2
if cls._api_version == 3:
cls.backups_client = cls.os_primary.backups_v3_client
cls.volumes_client = cls.os_primary.volumes_v3_client
cls.messages_client = cls.os_primary.volume_v3_messages_client
cls.versions_client = cls.os_primary.volume_v3_versions_client
cls.groups_client = cls.os_primary.groups_v3_client
cls.group_snapshots_client = (
cls.os_primary.group_snapshots_v3_client)
else:
cls.backups_client = cls.os_primary.backups_v2_client
cls.volumes_client = cls.os_primary.volumes_v2_client
cls.snapshots_client = cls.os_primary.snapshots_v2_client
cls.backups_client = cls.os_primary.backups_client_latest
cls.volumes_client = cls.os_primary.volumes_client_latest
cls.messages_client = cls.os_primary.volume_messages_client_latest
cls.versions_client = cls.os_primary.volume_versions_client_latest
cls.groups_client = cls.os_primary.groups_client_latest
cls.group_snapshots_client = (
cls.os_primary.group_snapshots_client_latest)
cls.snapshots_client = cls.os_primary.snapshots_client_latest
cls.volumes_extension_client =\
cls.os_primary.volumes_v2_extension_client
cls.os_primary.volumes_extension_client_latest
cls.availability_zone_client = (
cls.os_primary.volume_v2_availability_zone_client)
cls.volume_limits_client = cls.os_primary.volume_v2_limits_client
cls.os_primary.volume_availability_zone_client_latest)
cls.volume_limits_client = cls.os_primary.volume_limits_client_latest
def setUp(self):
super(BaseVolumeTest, self).setUp()
@ -247,34 +242,34 @@ class BaseVolumeAdminTest(BaseVolumeTest):
def setup_clients(cls):
super(BaseVolumeAdminTest, cls).setup_clients()
cls.admin_volume_qos_client = cls.os_admin.volume_qos_v2_client
cls.admin_volume_qos_client = cls.os_admin.volume_qos_client_latest
cls.admin_volume_services_client = \
cls.os_admin.volume_services_v2_client
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
cls.admin_volume_manage_client = cls.os_admin.volume_manage_v2_client
cls.admin_volume_client = cls.os_admin.volumes_v2_client
if cls._api_version == 3:
cls.admin_volume_client = cls.os_admin.volumes_v3_client
cls.admin_groups_client = cls.os_admin.groups_v3_client
cls.admin_messages_client = cls.os_admin.volume_v3_messages_client
cls.admin_group_snapshots_client = \
cls.os_admin.group_snapshots_v3_client
cls.admin_group_types_client = cls.os_admin.group_types_v3_client
cls.admin_hosts_client = cls.os_admin.volume_hosts_v2_client
cls.os_admin.volume_services_client_latest
cls.admin_volume_types_client = cls.os_admin.volume_types_client_latest
cls.admin_volume_manage_client = (
cls.os_admin.volume_manage_client_latest)
cls.admin_volume_client = cls.os_admin.volumes_client_latest
cls.admin_groups_client = cls.os_admin.groups_client_latest
cls.admin_messages_client = cls.os_admin.volume_messages_client_latest
cls.admin_group_snapshots_client = \
cls.os_admin.group_snapshots_client_latest
cls.admin_group_types_client = cls.os_admin.group_types_client_latest
cls.admin_hosts_client = cls.os_admin.volume_hosts_client_latest
cls.admin_snapshot_manage_client = \
cls.os_admin.snapshot_manage_v2_client
cls.admin_snapshots_client = cls.os_admin.snapshots_v2_client
cls.admin_backups_client = cls.os_admin.backups_v2_client
cls.os_admin.snapshot_manage_client_latest
cls.admin_snapshots_client = cls.os_admin.snapshots_client_latest
cls.admin_backups_client = cls.os_admin.backups_client_latest
cls.admin_encryption_types_client = \
cls.os_admin.encryption_types_v2_client
cls.os_admin.encryption_types_client_latest
cls.admin_quota_classes_client = \
cls.os_admin.volume_quota_classes_v2_client
cls.admin_quotas_client = cls.os_admin.volume_quotas_v2_client
cls.admin_volume_limits_client = cls.os_admin.volume_v2_limits_client
cls.os_admin.volume_quota_classes_client_latest
cls.admin_quotas_client = cls.os_admin.volume_quotas_client_latest
cls.admin_volume_limits_client = (
cls.os_admin.volume_limits_client_latest)
cls.admin_capabilities_client = \
cls.os_admin.volume_capabilities_v2_client
cls.os_admin.volume_capabilities_client_latest
cls.admin_scheduler_stats_client = \
cls.os_admin.volume_scheduler_stats_v2_client
cls.os_admin.volume_scheduler_stats_client_latest
@classmethod
def create_test_qos_specs(cls, name=None, consumer=None, **kwargs):

View File

@ -27,10 +27,10 @@ class VolumesTransfersTest(base.BaseVolumeTest):
def setup_clients(cls):
super(VolumesTransfersTest, cls).setup_clients()
cls.client = cls.os_primary.volume_transfers_v2_client
cls.alt_client = cls.os_alt.volume_transfers_v2_client
cls.alt_volumes_client = cls.os_alt.volumes_v2_client
cls.adm_volumes_client = cls.os_admin.volumes_v2_client
cls.client = cls.os_primary.volume_transfers_client_latest
cls.alt_client = cls.os_alt.volume_transfers_client_latest
cls.alt_volumes_client = cls.os_alt.volumes_client_latest
cls.adm_volumes_client = cls.os_admin.volumes_client_latest
@decorators.idempotent_id('4d75b645-a478-48b1-97c8-503f64242f1a')
def test_create_get_list_accept_volume_transfer(self):

View File

@ -241,6 +241,47 @@ class Manager(clients.ServiceClients):
# if only api_v3 is enabled, all these clients should be available
if (CONF.volume_feature_enabled.api_v2 or
CONF.volume_feature_enabled.api_v3):
self.backups_client_latest = self.volume_v3.BackupsClient()
self.encryption_types_client_latest = \
self.volume_v3.EncryptionTypesClient()
self.snapshot_manage_client_latest = \
self.volume_v3.SnapshotManageClient()
self.snapshots_client_latest = self.volume_v3.SnapshotsClient()
self.volume_capabilities_client_latest = \
self.volume_v3.CapabilitiesClient()
self.volume_manage_client_latest = (
self.volume_v3.VolumeManageClient())
self.volume_qos_client_latest = self.volume_v3.QosSpecsClient()
self.volume_services_client_latest = (
self.volume_v3.ServicesClient())
self.volume_types_client_latest = self.volume_v3.TypesClient()
self.volume_hosts_client_latest = self.volume_v3.HostsClient()
self.volume_quotas_client_latest = self.volume_v3.QuotasClient()
self.volume_quota_classes_client_latest = \
self.volume_v3.QuotaClassesClient()
self.volume_scheduler_stats_client_latest = \
self.volume_v3.SchedulerStatsClient()
self.volume_transfers_client_latest = \
self.volume_v3.TransfersClient()
self.volume_availability_zone_client_latest = \
self.volume_v3.AvailabilityZoneClient()
self.volume_limits_client_latest = self.volume_v3.LimitsClient()
self.volumes_client_latest = self.volume_v3.VolumesClient()
self.volumes_extension_client_latest = \
self.volume_v3.ExtensionsClient()
self.group_types_client_latest = self.volume_v3.GroupTypesClient()
self.groups_client_latest = self.volume_v3.GroupsClient()
self.group_snapshots_client_latest = \
self.volume_v3.GroupSnapshotsClient()
self.volume_messages_client_latest = (
self.volume_v3.MessagesClient())
self.volume_versions_client_latest = (
self.volume_v3.VersionsClient())
# TODO(gmann): Below alias for service clients have been
# deprecated and will be removed in future. Start using the alias
# defined above with suffix _latest.
# ****************Deprecated alias start from here***************
self.backups_v2_client = self.volume_v3.BackupsClient()
self.encryption_types_v2_client = \
self.volume_v3.EncryptionTypesClient()
@ -268,11 +309,6 @@ class Manager(clients.ServiceClients):
self.volumes_v2_extension_client = \
self.volume_v3.ExtensionsClient()
# Set default client for users that don't need explicit version
self.volumes_client_latest = self.volumes_v2_client
self.snapshots_client_latest = self.snapshots_v2_client
self.backups_client_latest = self.backups_v2_client
if CONF.volume_feature_enabled.api_v3:
self.backups_v3_client = self.volume_v3.BackupsClient()
self.group_types_v3_client = self.volume_v3.GroupTypesClient()
@ -283,11 +319,7 @@ class Manager(clients.ServiceClients):
self.volume_v3_messages_client = self.volume_v3.MessagesClient()
self.volume_v3_versions_client = self.volume_v3.VersionsClient()
self.volumes_v3_client = self.volume_v3.VolumesClient()
# Set default client for users that don't need explicit version
self.volumes_client_latest = self.volumes_v3_client
self.snapshots_client_latest = self.snapshots_v3_client
self.backups_client_latest = self.backups_v3_client
# ****************Deprecated alias end here***********************
def _set_object_storage_clients(self):
self.account_client = self.object_storage.AccountClient()

View File

@ -315,7 +315,7 @@ class VolumeService(BaseService):
class VolumeQuotaService(BaseService):
def __init__(self, manager, **kwargs):
super(VolumeQuotaService, self).__init__(kwargs)
self.client = manager.volume_quotas_v2_client
self.client = manager.volume_quotas_client_latest
def delete(self):
client = self.client

View File

@ -165,7 +165,7 @@ def create_test_server(clients, validatable=False, validation_resources=None,
if volume_backed:
volume_name = data_utils.rand_name(__name__ + '-volume')
volumes_client = clients.volumes_v2_client
volumes_client = clients.volumes_client_latest
params = {'name': volume_name,
'imageRef': image_id,
'size': CONF.volume.volume_size}

View File

@ -301,7 +301,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
def create_volume_type(self, client=None, name=None, backend_name=None):
if not client:
client = self.os_admin.volume_types_v2_client
client = self.os_admin.volume_types_client_latest
randomized_name = name or data_utils.rand_name(
'volume-type-' + self.__class__.__name__)
@ -1208,9 +1208,9 @@ class EncryptionScenarioTest(ScenarioTest):
@classmethod
def setup_clients(cls):
super(EncryptionScenarioTest, cls).setup_clients()
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
cls.admin_volume_types_client = cls.os_admin.volume_types_client_latest
cls.admin_encryption_types_client =\
cls.os_admin.encryption_types_v2_client
cls.os_admin.encryption_types_client_latest
def create_encryption_type(self, client=None, type_id=None, provider=None,
key_size=None, cipher=None,

View File

@ -40,7 +40,7 @@ class TestVolumeMigrateRetypeAttached(manager.ScenarioTest):
@classmethod
def setup_clients(cls):
super(TestVolumeMigrateRetypeAttached, cls).setup_clients()
cls.admin_volumes_client = cls.os_admin.volumes_v2_client
cls.admin_volumes_client = cls.os_admin.volumes_client_latest
@classmethod
def skip_checks(cls):