From 111104b9a2fd54de2559041249bdb7a10c64664c Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Thu, 29 Sep 2022 17:15:53 +0300 Subject: [PATCH] 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 --- manila/image/glance.py | 4 ++++ manila/tests/image/test_image.py | 4 ++++ ...-1991396-add-glance-endpoint-type-151777f255e423a3.yaml | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/bug-1991396-add-glance-endpoint-type-151777f255e423a3.yaml diff --git a/manila/image/glance.py b/manila/image/glance.py index 4cbefedc6e..4f4203edc5 100644 --- a/manila/image/glance.py +++ b/manila/image/glance.py @@ -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) diff --git a/manila/tests/image/test_image.py b/manila/tests/image/test_image.py index 2f68cf1fc2..a30284ea6d 100644 --- a/manila/tests/image/test_image.py +++ b/manila/tests/image/test_image.py @@ -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'] ) diff --git a/releasenotes/notes/bug-1991396-add-glance-endpoint-type-151777f255e423a3.yaml b/releasenotes/notes/bug-1991396-add-glance-endpoint-type-151777f255e423a3.yaml new file mode 100644 index 0000000000..094978cf16 --- /dev/null +++ b/releasenotes/notes/bug-1991396-add-glance-endpoint-type-151777f255e423a3.yaml @@ -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 `_).