Add .deployment.v1.deploy_on_servers to ffwd-upgrade prepare

Before we update the heat stack for the ffwd-upgrade prepare we
can use this to run any required commands on the overcloud.

The current use case is removal of the
/usr/libexec/os-apply-config/templates/etc/os-net-config/config.json
Otherwise after the upgrade prepare is executed, overcloud nodes
will have empty config.json for os-net-config (also discussed [0])

The current implementation of .deployment.v1.deploy_on_servers assumes
all servers are managed by nova. This is OK for N..Q ffu but we will
need to revisit in future, see [1] for more info.

[0]: https://bugzilla.redhat.com/show_bug.cgi?id=1561255
[1]: https://bugs.launchpad.net/tripleo/+bug/1770356
Related-Bug: 1758161
Related:
    tripleo-common Ic138c4925c5c96d1cf718af7ae59bcf5f0ba96dc
Change-Id: I77fdc9deab97c785725f09b8529c512950753f86
This commit is contained in:
mandreou 2018-05-04 17:30:11 +03:00
parent e8a12eac8f
commit 08360e4667
4 changed files with 33 additions and 1 deletions

View File

@ -62,6 +62,9 @@ UPGRADE_PREPARE_ENV = "environments/lifecycle/upgrade-prepare.yaml"
UPGRADE_CONVERGE_ENV = "environments/lifecycle/upgrade-converge.yaml"
FFWD_UPGRADE_PREPARE_ENV = "environments/lifecycle/ffwd-upgrade-prepare.yaml"
FFWD_UPGRADE_CONVERGE_ENV = "environments/lifecycle/ffwd-upgrade-converge.yaml"
FFWD_UPGRADE_PREPARE_SCRIPT = ("#!/bin/bash \n"
"rm -f /usr/libexec/os-apply-config/templates/"
"etc/os-net-config/config.json || true \n")
CEPH_UPGRADE_PREPARE_ENV = "environments/lifecycle/ceph-upgrade-prepare.yaml"
ENABLE_SSH_ADMIN_TIMEOUT = 300

View File

@ -25,7 +25,7 @@ class FakeClientWrapper(object):
self._instance = mock.Mock()
self.object_store = FakeObjectClient()
def messaging_websocket(self):
def messaging_websocket(self, queue="tripleo"):
return fakes.FakeWebSocket()

View File

@ -68,6 +68,14 @@ class FFWDUpgradePrepare(DeployOvercloud):
parsed_args.stack)
stack_name = stack.stack_name
# ffwd-upgrade "init" run command on overcloud nodes
package_update.run_on_nodes(
clients, server_name='all',
config_name='ffwd-upgrade-prepare',
config=constants.FFWD_UPGRADE_PREPARE_SCRIPT, group='script',
queue_name=constants.FFWD_UPGRADE_QUEUE)
registry = oooutils.load_container_registry(
self.log, parsed_args.container_registry_file)
ceph_ansible_playbook = parsed_args.ceph_ansible_playbook

View File

@ -169,3 +169,24 @@ def ffwd_converge_nodes(clients, **workflow_input):
print('Success')
else:
raise RuntimeError('ffwd upgrade converge failed: {}'.format(payload))
def run_on_nodes(clients, **workflow_input):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
with tripleoclients.messaging_websocket(
workflow_input['queue_name']) as ws:
execution = base.start_workflow(
workflow_client,
'tripleo.deployment.v1.deploy_on_servers',
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution):
assert payload['status'] == "SUCCESS", pprint.pformat(payload)
if payload['status'] == "SUCCESS":
print('Success')
else:
raise RuntimeError('run on nodes failed: {}'.format(payload))