Handle available volume client versions
If Cinder is not available or Cinder v1 only is available skip volume attachment tests. Else prefer volume v3 where available or fallback to v2 otherwise. This requires a Tempest patch for the snapshots v3 client. Change-Id: If3b6a2c71498c19a0a8dfeb4c51e2c80e5a918f4 Depends-on: I21f07f7b3e8f22055e7978c0bf4aa01b80b493d9
This commit is contained in:
parent
eda6842496
commit
eb19ad160a
|
@ -58,9 +58,6 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase):
|
|||
params = config.service_client_config('orchestration')
|
||||
cls.orchestration_client = orchestration.OrchestrationClient(
|
||||
cls.services_manager.auth_provider, **params)
|
||||
cls.snapshots_client = cls.services_manager.snapshots_v2_client
|
||||
cls.volumes_client = cls.services_manager.volumes_v2_client
|
||||
cls.backups_client = cls.services_manager.backups_v2_client
|
||||
cls.images_client = cls.services_manager.image_client_v2
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -26,6 +26,30 @@ CONF = config.CONF
|
|||
|
||||
class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestCinderVolumes, cls).skip_checks()
|
||||
if not CONF.service_available.cinder:
|
||||
msg = "Cinder is not available. Skipping volumes attachment tests"
|
||||
raise cls.skipException(msg)
|
||||
if (not CONF.volume_feature_enabled.api_v3 and
|
||||
not CONF.volume_feature_enabled.api_v2):
|
||||
msg = ("Neither cinder v2 nor v3 are not available. Skipping"
|
||||
"volumes attachment tests")
|
||||
raise cls.skipException(msg)
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
super(TestCinderVolumes, cls).setup_clients()
|
||||
# Prefer volume v3 which is the current version
|
||||
if CONF.volume_feature_enabled.api_v3:
|
||||
_volume = cls.services_manager.volume_v3
|
||||
elif CONF.volume_feature_enabled.api_v2:
|
||||
_volume = cls.services_manager.volume_v2
|
||||
cls.volumes_client = _volume.VolumesClient()
|
||||
cls.backups_client = _volume.BackupsClient()
|
||||
cls.snapshots_client = _volume.SnapshotsClient()
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
if not CONF.application_catalog.cinder_volume_tests:
|
||||
|
|
Loading…
Reference in New Issue