Handle volume API version enablement

This is a start to have tempest handle Cinder API versions
based on what is actually enabled. There are currently a
lot of places in the code the assume v1 and v2 are available,
but those versions may be disabled, especially as we try to
get everyone moved onto the latest (final?) v3 API version.

There are more areas that should be fixed up before we can
actually just work with v3 only, but this is a start to get
there.

Closes-bug: #1703044
Change-Id: Icc2e12f06c3b4899f934f000e191552f4a5cd2a9
This commit is contained in:
Sean McGinnis 2017-07-07 16:39:24 -05:00
parent 21dd8a5ee2
commit ff5f0c14f7
4 changed files with 60 additions and 46 deletions

View File

@ -36,7 +36,7 @@ class BaseVolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
def setup_credentials(cls):
super(BaseVolumeQuotasAdminTestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.os_primary.credentials.tenant_id
cls.alt_client = cls.os_alt.volumes_client
cls.alt_client = cls.os_alt.volumes_client_latest
@classmethod
def setup_clients(cls):

View File

@ -30,7 +30,7 @@ class VolumeTypesAccessTest(base.BaseVolumeAdminTest):
@classmethod
def setup_clients(cls):
super(VolumeTypesAccessTest, cls).setup_clients()
cls.alt_client = cls.os_alt.volumes_client
cls.alt_client = cls.os_alt.volumes_client_latest
@decorators.idempotent_id('d4dd0027-835f-4554-a6e5-50903fb79184')
def test_volume_type_access_add(self):

View File

@ -229,49 +229,63 @@ class Manager(clients.ServiceClients):
def _set_volume_clients(self):
self.volume_qos_client = self.volume_v1.QosSpecsClient()
self.volume_qos_v2_client = self.volume_v2.QosSpecsClient()
self.volume_services_client = self.volume_v1.ServicesClient()
self.volume_services_v2_client = self.volume_v2.ServicesClient()
self.backups_client = self.volume_v1.BackupsClient()
self.backups_v2_client = self.volume_v2.BackupsClient()
self.backups_v3_client = self.volume_v3.BackupsClient()
self.encryption_types_client = self.volume_v1.EncryptionTypesClient()
self.encryption_types_v2_client = \
self.volume_v2.EncryptionTypesClient()
self.snapshot_manage_v2_client = self.volume_v2.SnapshotManageClient()
self.snapshots_client = self.volume_v1.SnapshotsClient()
self.snapshots_v2_client = self.volume_v2.SnapshotsClient()
self.volume_manage_v2_client = self.volume_v2.VolumeManageClient()
self.volumes_client = self.volume_v1.VolumesClient()
self.volumes_v2_client = self.volume_v2.VolumesClient()
self.volumes_v3_client = self.volume_v3.VolumesClient()
self.volume_v3_messages_client = self.volume_v3.MessagesClient()
self.volume_v3_versions_client = self.volume_v3.VersionsClient()
self.volume_types_client = self.volume_v1.TypesClient()
self.volume_types_v2_client = self.volume_v2.TypesClient()
self.volume_hosts_client = self.volume_v1.HostsClient()
self.volume_hosts_v2_client = self.volume_v2.HostsClient()
self.volume_quotas_client = self.volume_v1.QuotasClient()
self.volume_quotas_v2_client = self.volume_v2.QuotasClient()
self.volume_quota_classes_v2_client = \
self.volume_v2.QuotaClassesClient()
self.volumes_extension_client = self.volume_v1.ExtensionsClient()
self.volumes_v2_extension_client = self.volume_v2.ExtensionsClient()
self.groups_v3_client = self.volume_v3.GroupsClient()
self.group_types_v3_client = self.volume_v3.GroupTypesClient()
self.volume_availability_zone_client = \
self.volume_v1.AvailabilityZoneClient()
self.volume_v2_availability_zone_client = \
self.volume_v2.AvailabilityZoneClient()
self.volume_limits_client = self.volume_v1.LimitsClient()
self.volume_v2_limits_client = self.volume_v2.LimitsClient()
self.volume_capabilities_v2_client = \
self.volume_v2.CapabilitiesClient()
self.volume_scheduler_stats_v2_client = \
self.volume_v2.SchedulerStatsClient()
self.volume_transfers_v2_client = \
self.volume_v2.TransfersClient()
if CONF.volume_feature_enabled.api_v1:
self.backups_client = self.volume_v1.BackupsClient()
self.encryption_types_client = \
self.volume_v1.EncryptionTypesClient()
self.snapshots_client = self.volume_v1.SnapshotsClient()
self.volume_availability_zone_client = \
self.volume_v1.AvailabilityZoneClient()
self.volume_hosts_client = self.volume_v1.HostsClient()
self.volume_limits_client = self.volume_v1.LimitsClient()
self.volume_qos_client = self.volume_v1.QosSpecsClient()
self.volume_quotas_client = self.volume_v1.QuotasClient()
self.volume_services_client = self.volume_v1.ServicesClient()
self.volume_types_client = self.volume_v1.TypesClient()
self.volumes_client = self.volume_v1.VolumesClient()
self.volumes_extension_client = self.volume_v1.ExtensionsClient()
if CONF.volume_feature_enabled.api_v2:
self.backups_v2_client = self.volume_v2.BackupsClient()
self.encryption_types_v2_client = \
self.volume_v2.EncryptionTypesClient()
self.snapshot_manage_v2_client = \
self.volume_v2.SnapshotManageClient()
self.snapshots_v2_client = self.volume_v2.SnapshotsClient()
self.volume_capabilities_v2_client = \
self.volume_v2.CapabilitiesClient()
self.volume_manage_v2_client = self.volume_v2.VolumeManageClient()
self.volume_qos_v2_client = self.volume_v2.QosSpecsClient()
self.volume_services_v2_client = self.volume_v2.ServicesClient()
self.volume_types_v2_client = self.volume_v2.TypesClient()
self.volume_hosts_v2_client = self.volume_v2.HostsClient()
self.volume_quotas_v2_client = self.volume_v2.QuotasClient()
self.volume_quota_classes_v2_client = \
self.volume_v2.QuotaClassesClient()
self.volume_scheduler_stats_v2_client = \
self.volume_v2.SchedulerStatsClient()
self.volume_transfers_v2_client = \
self.volume_v2.TransfersClient()
self.volume_v2_availability_zone_client = \
self.volume_v2.AvailabilityZoneClient()
self.volume_v2_limits_client = self.volume_v2.LimitsClient()
self.volumes_v2_client = self.volume_v2.VolumesClient()
self.volumes_v2_extension_client = \
self.volume_v2.ExtensionsClient()
# Set default client for users that don't need explicit version
self.volumes_client_latest = self.volumes_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()
self.groups_v3_client = self.volume_v3.GroupsClient()
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
def _set_object_storage_clients(self):
# NOTE(andreaf) Load configuration from config. Once object storage

View File

@ -95,7 +95,7 @@ def _get_api_versions(os, service):
client_dict = {
'nova': os.servers_client,
'keystone': os.identity_client,
'cinder': os.volumes_client,
'cinder': os.volumes_client_latest,
}
if service != 'keystone' and service != 'cinder':
# Since keystone and cinder may be listening on a path,