Allow setting endpoint_type for glance

currently Manila always uses public endpoint of Glance, which
may not be possible in certain deployment scenarios.

Change-Id: Ic17ac43160092445ec11ada41c0eb6eaf525b6d0
Closes-Bug: #1991396
(cherry picked from commit 111104b9a2)
This commit is contained in:
Pavlo Shchelokovskyy 2022-09-29 17:15:53 +03:00 committed by Goutham Pacha Ravi
parent dea2503c82
commit 440881392c
3 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,9 @@ glance_opts = [
cfg.StrOpt('region_name',
default='RegionOne',
help='Region name for connecting to glance.'),
cfg.StrOpt('endpoint_type',
default='publicURL',
help='Endpoint type to be used with glance client calls.'),
]
CONF = cfg.CONF
@ -55,6 +58,7 @@ def glanceclient(context):
client_class=glance_client.Client, cfg_group=GLANCE_GROUP)
return AUTH_OBJ.get_client(context,
version=CONF[GLANCE_GROUP].api_microversion,
interface=CONF[GLANCE_GROUP].endpoint_type,
region_name=CONF[GLANCE_GROUP].region_name)

View File

@ -49,6 +49,7 @@ class GlanceClientTestCase(test.TestCase):
data = {
'glance': {
'api_microversion': 'foo_api_microversion',
'endpoint_type': 'internal',
'region_name': 'foo_region_name'
}
}
@ -63,6 +64,7 @@ class GlanceClientTestCase(test.TestCase):
mock_client_loader.return_value.get_client.assert_called_once_with(
fake_context,
version=data['glance']['api_microversion'],
interface=data['glance']['endpoint_type'],
region_name=data['glance']['region_name']
)
@ -72,6 +74,7 @@ class GlanceClientTestCase(test.TestCase):
data = {
'glance': {
'api_microversion': 'foo_api_microversion',
'endpoint_type': 'internal',
'region_name': 'foo_region_name'
}
}
@ -82,6 +85,7 @@ class GlanceClientTestCase(test.TestCase):
glance.AUTH_OBJ.get_client.assert_called_once_with(
fake_context,
version=data['glance']['api_microversion'],
interface=data['glance']['endpoint_type'],
region_name=data['glance']['region_name']
)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Deployers now can specify ``[glance]endpoint_type`` configuration option
(defaults to ``publicURL`` for backward compatibility)
so that Manila uses Glance endpoint other than the public one
(see `bug 1991396 <https://bugs.launchpad.net/manila/+bug/1991396>`_).