config: ignore missing server_id from the stack

When blacklisting nodes on the overcloud, we don't want to generated
a configuration with these servers.
This patch ignore the server when server_id can't be found in the stack
when generating the configuration of the overcloud.
A warning is shown so the operator knows this server isn't part of the
configuration, probably due to blacklisting.
If getting the server name fails for another reason than a KeyError,
we fail the configuration generation and raise an exception with the
error message.

Change-Id: Ie7660894050e5eca251aaf8c10f0cc7e7d837dfc
Closes-Bug: #1793605
This commit is contained in:
Emilien Macchi 2018-09-21 17:32:18 -04:00
parent 17b8424d20
commit 272bd17c30
2 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes `bug 1793605 <https://bugs.launchpad.net/tripleo/+bug/1793605>`__ so
when nodes are blacklisted, they are not included in the Overcloud config.
A warning will show that the server_id that was ignored if the it can't
be found in the stack.

View File

@ -305,9 +305,23 @@ class Config(object):
[i for i in config_dict['inputs']
if i['name'] == 'deploy_server_id'].pop()
deploy_server_id_input['value'] = server_id
# We don't want to fail if server_id can't be found, as it's
# most probably due to blacklisted nodes. However we fail for
# other errors.
try:
server_deployments.setdefault(
server_names[server_id],
[]).append(config_dict)
except KeyError:
self.log.warning('Server with id %s is ignored from config '
'(may be blacklisted)' % server_id)
# continue the loop as this server_id is probably excluded
continue
except Exception as err:
err_msg = ('Error retrieving server name from this server_id: '
'%s with this error: %s' % server_id, err)
raise Exception(err_msg)
role = self.get_role_from_server_id(stack, server_id)
role_deployments = role_deployment_names.setdefault(role, {})