Fix IHA with the new region_name key

ia change f2e72352b1 we did the following
in nova-base.yaml:
- nova::placement::os_region_name: {get_param: KeystoneRegion}
+ nova::placement::region_name: {get_param: KeystoneRegion}

But in the IHA script we looked for the os_region_name config key in the
placemenet ini section of nova.conf, which is now missing.
We need to adapt that script as well. Without this fix we'll error
out like this:
Oct 16 09:08:12 overcloud-novacomputeiha-0 dockerd-current[14673]:   File "/var/lib/nova/instanceha/check-run-nova-compute", line 147, in create_nova_connection
Oct 16 09:08:12 overcloud-novacomputeiha-0 dockerd-current[14673]:     region_name=options["os_region_name"][0],
Oct 16 09:08:12 overcloud-novacomputeiha-0 dockerd-current[14673]: KeyError: 'os_region_name'

Closes-Bug: #1798560

Change-Id: I8906145955ab6c444efdfa73beca073a62c26e26
This commit is contained in:
Michele Baldessari 2018-10-18 11:19:09 +02:00
parent a6cf9b8b14
commit 9235e30c08

View File

@ -111,6 +111,12 @@ def create_nova_connection(options):
if nova_endpoint_type in ['internal', 'public', 'admin']:
nova_endpoint_type += 'URL'
if 'region_name' in options:
region = options['region_name'][0]
elif 'os_region_name' in options:
region = options['os_region_name'][0]
else: # We actually try to make a client call even with an empty region
region = None
nova_versions = [ "2.23", "2" ]
for version in nova_versions:
clientargs = inspect.getargspec(client.Client).varargs
@ -136,7 +142,7 @@ def create_nova_connection(options):
None, # Tenant
None, # Auth URL
insecure=options["insecure"],
region_name=options["os_region_name"][0],
region_name=region,
session=keystone_session, auth=keystone_auth,
http_log_debug=options.has_key("verbose"),
endpoint_type=nova_endpoint_type)
@ -144,7 +150,7 @@ def create_nova_connection(options):
# OSP >= Ocata
# ArgSpec(args=['version'], varargs='args', keywords='kwargs', defaults=None)
nova = client.Client(version,
region_name=options["os_region_name"][0],
region_name=region,
session=keystone_session, auth=keystone_auth,
http_log_debug=options.has_key("verbose"),
endpoint_type=nova_endpoint_type)