Allow to run with API v3 (remove deprecated options)
Remove the usage of api_version and let the library
code use catalog_type instead.
CONF.volume_feature_enabled.{api_v2,api_v3} have been deprecated
since rocky.
See also:
- https://review.opendev.org/#/c/698754/
- https://review.opendev.org/#/c/698757/
and other reviews.
Change-Id: Ic91f38ebff96df7d38a2d8cd2447e454c385c46c
Luigi Toscano
6 years ago
| 19 | 19 | from tempest.lib.common import api_version_utils |
| 20 | 20 | from tempest.lib.common.utils import data_utils |
| 21 | 21 | from tempest.lib.common.utils import test_utils |
| 22 | from tempest.lib import exceptions | |
| 23 | 22 | from tempest import test |
| 24 | 23 | |
| 25 | 24 | CONF = config.CONF |
| 29 | 28 | test.BaseTestCase): |
| 30 | 29 | """Base test case class for all Cinder API tests.""" |
| 31 | 30 | |
| 32 | _api_version = 2 | |
| 33 | 31 | credentials = ['primary'] |
| 34 | 32 | |
| 35 | 33 | @classmethod |
| 39 | 37 | if not CONF.service_available.cinder: |
| 40 | 38 | skip_msg = ("%s skipped as Cinder is not available" % cls.__name__) |
| 41 | 39 | raise cls.skipException(skip_msg) |
| 42 | if cls._api_version == 2: | |
| 43 | if not CONF.volume_feature_enabled.api_v2: | |
| 44 | msg = "Volume API v2 is disabled" | |
| 45 | raise cls.skipException(msg) | |
| 46 | elif cls._api_version == 3: | |
| 47 | if not CONF.volume_feature_enabled.api_v3: | |
| 48 | msg = "Volume API v3 is disabled" | |
| 49 | raise cls.skipException(msg) | |
| 50 | else: | |
| 51 | msg = ("Invalid Cinder API version (%s)" % cls._api_version) | |
| 52 | raise exceptions.InvalidConfiguration(msg) | |
| 53 | 40 | |
| 54 | 41 | api_version_utils.check_skip_with_microversion( |
| 55 | 42 | cls.min_microversion, cls.max_microversion, |
| 58 | 45 | @classmethod |
| 59 | 46 | def setup_clients(cls): |
| 60 | 47 | super(BaseVolumeTest, cls).setup_clients() |
| 61 | if cls._api_version == 3: | |
| 62 | cls.backups_client = cls.os_primary.backups_v3_client | |
| 63 | cls.volumes_client = cls.os_primary.volumes_v3_client | |
| 64 | else: | |
| 65 | cls.backups_client = cls.os_primary.backups_v2_client | |
| 66 | cls.volumes_client = cls.os_primary.volumes_v2_client | |
| 67 | ||
| 68 | cls.snapshots_client = cls.os_primary.snapshots_v2_client | |
| 48 | cls.backups_client = cls.os_primary.backups_client_latest | |
| 49 | cls.volumes_client = cls.os_primary.volumes_client_latest | |
| 50 | cls.snapshots_client = cls.os_primary.snapshots_client_latest | |
| 69 | 51 | |
| 70 | 52 | @classmethod |
| 71 | 53 | def setup_credentials(cls): |