Specify manila microversion header
Manila API honors a "X-OpenStack-Manila-API-Version" header to specify microversions. It may support the OpenStack-API-Version header in a future release, however, we'll need to maintain backwards compatibility with the existing API. Change-Id: Ia2e62d3a11a08adeb6d488b7c9b365f7ff2be3c8
This commit is contained in:
parent
6a662719ce
commit
112bcae1fb
@ -83,6 +83,8 @@ def _mv_legacy_headers_for_service(mv_service_type):
|
||||
headers.append("X-OpenStack-Nova-API-Version")
|
||||
elif mv_service_type == "baremetal":
|
||||
headers.append("X-OpenStack-Ironic-API-Version")
|
||||
elif mv_service_type in ["sharev2", "shared-file-system"]:
|
||||
headers.append("X-OpenStack-Manila-API-Version")
|
||||
return headers
|
||||
|
||||
|
||||
@ -614,6 +616,14 @@ class Session(object):
|
||||
if (service_type.startswith('volume') or
|
||||
service_type == 'block-storage'):
|
||||
service_type = 'volume'
|
||||
elif service_type.startswith('share'):
|
||||
# NOTE(gouthamr) manila doesn't honor the "OpenStack-API-Version"
|
||||
# header yet, but sending it does no harm - when the service
|
||||
# honors this header, it'll use the standardized name in the
|
||||
# service-types-authority and not the legacy name in the cloud's
|
||||
# service catalog
|
||||
service_type = 'shared-file-system'
|
||||
|
||||
headers.setdefault('OpenStack-API-Version',
|
||||
'{service_type} {microversion}'.format(
|
||||
service_type=service_type,
|
||||
|
@ -164,6 +164,17 @@ class SessionTests(utils.TestCase):
|
||||
self.assertEqual(headers['OpenStack-API-Version'], 'volume 2.30')
|
||||
self.assertEqual(len(headers.keys()), 1)
|
||||
|
||||
# shared file system service-type - shared-file-system microversion
|
||||
# (with service type aliases)
|
||||
for service_type in ['sharev2', 'shared-file-system']:
|
||||
headers = {}
|
||||
client_session.Session._set_microversion_headers(
|
||||
headers, (2, 30), None, {'service_type': service_type})
|
||||
self.assertEqual(headers['X-OpenStack-Manila-API-Version'], '2.30')
|
||||
self.assertEqual(headers['OpenStack-API-Version'],
|
||||
'shared-file-system 2.30')
|
||||
self.assertEqual(len(headers.keys()), 2)
|
||||
|
||||
# Headers already exist - no change
|
||||
headers = {
|
||||
'OpenStack-API-Version': 'compute 2.30',
|
||||
|
Loading…
Reference in New Issue
Block a user