Use block-storage as default cinder service type
A recent change in tempest switch cinder service type from volumev3 to block-storage, preventing us to discover correctly the endpoints. block-storage is the default service type for cinder since years but the volumev3 alias was widely used instead. We will now use block-storage as default now and keep volumev3 as alias. Also add block-store as another valid (but less used) alias. See: https://review.opendev.org/c/openstack/tempest/+/930296 Closes-bug: #2085878 Change-Id: If2ff4c3ac7049e4df57521af7707ba5203d286ac Signed-off-by: Arnaud M <arnaud.morin@gmail.com>
This commit is contained in:
parent
cf45187435
commit
a90e30c320
@ -79,7 +79,7 @@ zun_api_versions = _try_import('zunclient.api_versions')
|
||||
|
||||
|
||||
class NovaAction(base.OpenStackAction):
|
||||
_service_type = 'compute'
|
||||
_service_types = ['compute']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -115,7 +115,7 @@ class NovaAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class GlanceAction(base.OpenStackAction):
|
||||
_service_type = 'image'
|
||||
_service_types = ['image']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -142,7 +142,7 @@ class GlanceAction(base.OpenStackAction):
|
||||
|
||||
class KeystoneAction(base.OpenStackAction):
|
||||
|
||||
_service_type = 'identity'
|
||||
_service_types = ['identity']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -176,7 +176,7 @@ class KeystoneAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class HeatAction(base.OpenStackAction):
|
||||
_service_type = 'orchestration'
|
||||
_service_types = ['orchestration']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -204,7 +204,7 @@ class HeatAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class NeutronAction(base.OpenStackAction):
|
||||
_service_type = 'network'
|
||||
_service_types = ['network']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -229,7 +229,14 @@ class NeutronAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class CinderAction(base.OpenStackAction):
|
||||
_service_type = 'volumev3'
|
||||
# NOTE(amorin) block-storage is the official one, but since years,
|
||||
# cinder has been using volumev3 as default. The effort to switch
|
||||
# the default to block-storage has been done during epoxy cycle.
|
||||
# Also adding block-store as another alias.
|
||||
# See all service types here:
|
||||
# https://service-types.openstack.org/
|
||||
# lp-2085878
|
||||
_service_types = ['block-storage', 'volumev3', 'block-store']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -266,7 +273,7 @@ class CinderAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class MistralAction(base.OpenStackAction):
|
||||
_service_type = 'workflowv2'
|
||||
_service_types = ['workflowv2']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -293,7 +300,7 @@ class MistralAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class TroveAction(base.OpenStackAction):
|
||||
_service_type = 'database'
|
||||
_service_types = ['database']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -455,7 +462,7 @@ class SwiftServiceAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class ZaqarAction(base.OpenStackAction):
|
||||
_service_type = 'messaging'
|
||||
_service_types = ['messaging']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -590,7 +597,7 @@ class ZaqarAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class BarbicanAction(base.OpenStackAction):
|
||||
_service_type = 'key-manager'
|
||||
_service_types = ['key-manager']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -700,7 +707,7 @@ class BarbicanAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class DesignateAction(base.OpenStackAction):
|
||||
_service_type = 'dns'
|
||||
_service_types = ['dns']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -781,7 +788,7 @@ class TackerAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class AodhAction(base.OpenStackAction):
|
||||
_service_type = 'alarming'
|
||||
_service_types = ['alarming']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -812,7 +819,7 @@ class AodhAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class GnocchiAction(base.OpenStackAction):
|
||||
_service_type = 'metric'
|
||||
_service_types = ['metric']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -846,7 +853,7 @@ class GnocchiAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class VitrageAction(base.OpenStackAction):
|
||||
_service_type = 'rca'
|
||||
_service_types = ['rca']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
@ -918,7 +925,7 @@ class ZunAction(base.OpenStackAction):
|
||||
|
||||
|
||||
class ManilaAction(base.OpenStackAction):
|
||||
_service_type = 'sharev2'
|
||||
_service_types = ['sharev2']
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
|
@ -38,7 +38,7 @@ class OpenStackAction(actions.Action):
|
||||
_kwargs_for_run = {}
|
||||
client_method_name = None
|
||||
_service_name = None
|
||||
_service_type = None
|
||||
_service_types = []
|
||||
_client_class = None
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
@ -95,12 +95,28 @@ class OpenStackAction(actions.Action):
|
||||
:param context: the action context
|
||||
:return: dict that can be used to initialize service clients
|
||||
"""
|
||||
|
||||
return keystone_utils.get_session_and_auth(
|
||||
sess = None
|
||||
for service_type in self._service_types:
|
||||
try:
|
||||
sess = keystone_utils.get_session_and_auth(
|
||||
service_name=self._service_name,
|
||||
service_type=self._service_type,
|
||||
service_type=service_type,
|
||||
region_name=self.action_region,
|
||||
ctx=context)
|
||||
except exc.MistralKeystoneException:
|
||||
# Maybe this service_type was not found
|
||||
pass
|
||||
|
||||
if not sess:
|
||||
raise exc.MistralException(
|
||||
"Unable to get keystone session. Maybe endpoints are "
|
||||
"missing? (service_name=%s, service_types=%s,"
|
||||
" region_name=%s)"
|
||||
% (self._service_name, self._service_types,
|
||||
self.action_region)
|
||||
)
|
||||
|
||||
return sess
|
||||
|
||||
def get_service_endpoint(self):
|
||||
"""Get OpenStack service endpoint.
|
||||
@ -108,11 +124,26 @@ class OpenStackAction(actions.Action):
|
||||
'service_name' and 'service_type' are defined in specific OpenStack
|
||||
service action.
|
||||
"""
|
||||
endpoint = None
|
||||
for service_type in self._service_types:
|
||||
try:
|
||||
endpoint = keystone_utils.get_endpoint_for_project(
|
||||
service_name=self._service_name,
|
||||
service_type=self._service_type,
|
||||
service_type=service_type,
|
||||
region_name=self.action_region
|
||||
)
|
||||
except exc.MistralKeystoneException:
|
||||
# Maybe this service_type was not found
|
||||
pass
|
||||
|
||||
if not endpoint:
|
||||
raise exc.MistralException(
|
||||
"Unable to get service endpoint. Maybe endpoints are "
|
||||
"missing? (service_name=%s, service_types=%s,"
|
||||
" region_name=%s)"
|
||||
% (self._service_name, self._service_types,
|
||||
self.action_region)
|
||||
)
|
||||
|
||||
return endpoint
|
||||
|
||||
|
@ -27,3 +27,7 @@ class ApplicationContextNotFoundException(MistralException):
|
||||
|
||||
class ActionException(MistralException):
|
||||
http_code = 400
|
||||
|
||||
|
||||
class MistralKeystoneException(MistralException):
|
||||
message = "A unknown Keystone exception occurred"
|
||||
|
@ -203,7 +203,7 @@ def get_endpoint_for_project(service_name=None, service_type=None,
|
||||
break
|
||||
|
||||
if not endpoint:
|
||||
raise exceptions.MistralException(
|
||||
raise exceptions.MistralKeystoneException(
|
||||
"No endpoints found [service_name=%s, service_type=%s,"
|
||||
" region_name=%s]"
|
||||
% (service_name, service_type, region)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
Use ``block-storage`` as default cinder service type in mistral actions.
|
||||
Also adding ``volumev3`` and ``block-store`` as valid aliases.
|
||||
See lp-2085878.
|
Loading…
Reference in New Issue
Block a user