Support only volume api_v3 is enabled

Now if we set CONF.volume_feature_enabled.api_v2 to False while
setting CONF.volume_feature_enabled.api_v3 to True, some testcases
can't work properly, e.g., in scenario.manager.py, we have
    "if not client:
        client = self.os_admin.volume_types_v2_client"

In fact, we should support only volume api_v3 is enabled, which means
to run all volume testcases using v3 interfaces(not only those new
functions added in v3).

So this is to transfer all volume v2 clients to using v3 interfaces
if only api_v3 is enabled.

Change-Id: I6924f295bcc84797e3c59f8cc4b68c1e251b931d
This commit is contained in:
zhufl 2018-01-02 15:18:39 +08:00
parent ac6ce0005e
commit 15292a3221
2 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,11 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
"""Base test case class for all Cinder API tests."""
_api_version = 2
# if api_v2 is not enabled while api_v3 is enabled, the volume v2 classes
# should be transferred to volume v3 classes.
if (not CONF.volume_feature_enabled.api_v2 and
CONF.volume_feature_enabled.api_v3):
_api_version = 3
credentials = ['primary']
@classmethod

View File

@ -234,7 +234,9 @@ class Manager(clients.ServiceClients):
self.volumes_client = self.volume_v1.VolumesClient()
self.volumes_extension_client = self.volume_v1.ExtensionsClient()
if CONF.volume_feature_enabled.api_v2:
# 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_v2_client = self.volume_v2.BackupsClient()
self.encryption_types_v2_client = \
self.volume_v2.EncryptionTypesClient()