Pass on region when we don't have a valid ironic endpoint
If for some reason we don't have a valid endpoint to provide the
Ironic client, we should at the very least provide the information
it needs to make an informed decision.
Change-Id: I31fa1c6fb0b224fbb02f9ebf68abc6a3728e9389
Partial-Bug: #1825583
(cherry picked from commit 6eaa6db0ee
)
This commit is contained in:
parent
e6ca3838d9
commit
222f462444
|
@ -42,6 +42,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase):
|
|||
self.ironicclient = client_wrapper.IronicClientWrapper()
|
||||
# Do not waste time sleeping
|
||||
cfg.CONF.set_override('api_retry_interval', 0, 'ironic')
|
||||
cfg.CONF.set_override('region_name', 'RegionOne', 'ironic')
|
||||
get_ksa_adapter_p = mock.patch('nova.utils.get_ksa_adapter')
|
||||
self.addCleanup(get_ksa_adapter_p.stop)
|
||||
self.get_ksa_adapter = get_ksa_adapter_p.start()
|
||||
|
@ -115,6 +116,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase):
|
|||
'retry_interval': CONF.ironic.api_retry_interval,
|
||||
'os_ironic_api_version': ['1.46', '1.38'],
|
||||
'endpoint': None,
|
||||
'region_name': CONF.ironic.region_name,
|
||||
'interface': ['internal', 'public']}
|
||||
mock_ir_cli.assert_called_once_with(1, **expected)
|
||||
|
||||
|
|
|
@ -131,6 +131,10 @@ class IronicClientWrapper(object):
|
|||
if ironic_url is None:
|
||||
LOG.warning("Could not discover ironic_url via keystoneauth1: "
|
||||
"Adapter.get_endpoint %s", ironic_url_none_reason)
|
||||
# NOTE(eandersson): We pass in region here to make sure
|
||||
# that the Ironic client can make an educated decision when
|
||||
# we don't have a valid endpoint to pass on.
|
||||
kwargs['region_name'] = ironic_conf.region_name
|
||||
|
||||
try:
|
||||
cli = ironic.client.get_client(IRONIC_API_VERSION[0],
|
||||
|
|
Loading…
Reference in New Issue