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
(cherry picked from commit 272bd17c30
)
This commit is contained in:
parent
d22cb3ed82
commit
f86b2b4c55
|
@ -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.
|
|
@ -294,9 +294,23 @@ class Config(object):
|
||||||
[i for i in config_dict['inputs']
|
[i for i in config_dict['inputs']
|
||||||
if i['name'] == 'deploy_server_id'].pop()
|
if i['name'] == 'deploy_server_id'].pop()
|
||||||
deploy_server_id_input['value'] = server_id
|
deploy_server_id_input['value'] = server_id
|
||||||
server_deployments.setdefault(
|
|
||||||
server_names[server_id],
|
# We don't want to fail if server_id can't be found, as it's
|
||||||
[]).append(config_dict)
|
# 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 = self.get_role_from_server_id(stack, server_id)
|
||||||
role_deployments = role_deployment_names.setdefault(role, {})
|
role_deployments = role_deployment_names.setdefault(role, {})
|
||||||
|
|
Loading…
Reference in New Issue