From bd09a3ec4d6046ac6ebbde6776afae291994c91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Ollivier?= Date: Mon, 15 Apr 2019 01:20:33 +0200 Subject: [PATCH] Select block-storage as service type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit block-storage is the official service type for cinder, according to the service-types-authority starting from OpenStack Stein release [1]. It is unversioned endpoint which replaces old 'volume', 'volumev2' and 'volumev3'. Also, this patch changes mapping at rally_openstack.const.ServiceTypes, so all known Cinder service types matche the name of service without version. Specifiying specific service API version to use was never done by using these different versioned constants. Mostly this mapping is done for displaying service catalog via `rally deployment show` and `rally env info`. Another thing here is reverting a part of change [2]. It was a wrong attempt to handle the case of several endpoints of Cinder. [1] https://review.openstack.org/#/c/510939/ [2] https://review.openstack.org/#/c/637947/ Change-Id: Ice18db86267e43421a14660f0e66891be0406fad Signed-off-by: Cédric Ollivier --- CHANGELOG.rst | 12 +++++++++++- rally_openstack/consts.py | 8 ++++++-- rally_openstack/osclients.py | 2 +- rally_openstack/validators.py | 19 +++++++------------ 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 42d81b4b..926f671b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,16 @@ Changelog .. Release notes for existing releases are MUTABLE! If there is something that was missed or can be improved, feel free to change it! +Unreleased +---------- + +Changed +~~~~~~~ + +* A new unversioned service type **block-storage** is used as a default for + Cinder service. To use another service type, use ``api_versions@openstack`` + context or ``api_info`` property of environment configuration. + [1.4.0] - 2019-03-07 -------------------- @@ -35,7 +45,7 @@ Added * [scenario plugin] BarbicanSecrets.create_and_get * [scenario plugin] BarbicanSecrets.get * [scenario plugin] BarbicanSecrets.create_and_list - * [scenario plugin] BarbicanSecrets.create_symmetric_and_delete + * [scenario plugin] BarbicanSecrets.create_symmetric_and_delete * Added octavia scenarios * [scenario plugin] Octavia.create_and_list_loadbalancers * [scenario plugin] Octavia.create_and_delete_loadbalancers diff --git a/rally_openstack/consts.py b/rally_openstack/consts.py index 062f1329..caadc888 100644 --- a/rally_openstack/consts.py +++ b/rally_openstack/consts.py @@ -74,6 +74,7 @@ class _Service(utils.ImmutableMixin, utils.EnumMixin): class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): """OpenStack services types, mapped to service names.""" + BLOCK_STORAGE = "block-storage" VOLUME = "volume" VOLUMEV2 = "volumev2" VOLUMEV3 = "volumev3" @@ -107,9 +108,12 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): self.__names = { self.CLUSTERING: _Service.SENLIN, self.COMPUTE: _Service.NOVA, + # unversioned endpoint of Cinder + self.BLOCK_STORAGE: _Service.CINDER, + # legacy versioned endpoints of Cinder self.VOLUME: _Service.CINDER, - self.VOLUMEV2: _Service.CINDERV2, - self.VOLUMEV3: _Service.CINDERV3, + self.VOLUMEV2: _Service.CINDER, + self.VOLUMEV3: _Service.CINDER, self.SHARE: _Service.MANILA, self.EC2: _Service.EC2, self.IMAGE: _Service.GLANCE, diff --git a/rally_openstack/osclients.py b/rally_openstack/osclients.py index 2ce38610..7438f51f 100644 --- a/rally_openstack/osclients.py +++ b/rally_openstack/osclients.py @@ -508,7 +508,7 @@ class Heat(OSClient): return client -@configure("cinder", default_version="3", default_service_type="volumev3", +@configure("cinder", default_version="3", default_service_type="block-storage", supported_versions=["1", "2", "3"]) class Cinder(OSClient): """Wrapper for CinderClient which returns an authenticated native client. diff --git a/rally_openstack/validators.py b/rally_openstack/validators.py index 629dd482..6434cf43 100644 --- a/rally_openstack/validators.py +++ b/rally_openstack/validators.py @@ -463,15 +463,14 @@ class RequiredServicesValidator(validation.Validator): creds = (context.get("admin", {}).get("credential", None) or context["users"][0]["credential"]) - clients = creds.clients() - available_services = clients.services().values() - if "api_versions" in config.get("contexts", {}): api_versions = config["contexts"]["api_versions"] else: api_versions = config.get("contexts", {}).get( "api_versions@openstack", {}) + available_services = creds.clients().services().values() + for service in self.services: service_config = api_versions.get(service, {}) if ("service_type" in service_config @@ -482,15 +481,11 @@ class RequiredServicesValidator(validation.Validator): continue if service not in available_services: - service_client = getattr(clients, service) - default_st = service_client._meta_get("default_service_type") - - if default_st not in clients.services(): - self.fail( - ("'{0}' service is not available. Hint: If '{0}' " - "service has non-default service_type, try to setup " - "it via 'api_versions@openstack' context." - ).format(service)) + self.fail( + ("'{0}' service is not available. Hint: If '{0}' " + "service has non-default service_type, try to setup " + "it via 'api_versions@openstack' context." + ).format(service)) @validation.add("required_platform", platform="openstack", users=True)