Use a single queue for update/upgrade
Use a single queue for update and upgrade ansible run to avoid race while consuming both messages from the web wocket Manual Cherry-pick from: I8b04c2a39d35f530467ddb5f2c4305c08cbc44f1 Change-Id: I8b04c2a39d35f530467ddb5f2c4305c08cbc44f1 Closes-Bug: #1804812
This commit is contained in:
parent
5fd323ce58
commit
66fbbee6d3
|
@ -32,13 +32,8 @@ DEFAULT_ENV_DIRECTORY = "~/.tripleo/environments"
|
|||
TRIPLEO_PUPPET_MODULES = "/usr/share/openstack-puppet/modules/"
|
||||
PUPPET_MODULES = "/etc/puppet/modules/"
|
||||
PUPPET_BASE = "/etc/puppet/"
|
||||
# Update Queue
|
||||
UPDATE_QUEUE = 'update'
|
||||
UPGRADE_QUEUE = 'upgrade'
|
||||
FFWD_UPGRADE_QUEUE = 'ffwdupgrade'
|
||||
CEPH_UPGRADE_QUEUE = 'cephupgrade'
|
||||
STACK_TIMEOUT = 240
|
||||
|
||||
STACK_TIMEOUT = 240
|
||||
|
||||
# The default ffwd upgrade ansible playbooks generated from heat stack output
|
||||
FFWD_UPGRADE_PLAYBOOK = "fast_forward_upgrade_playbook.yaml"
|
||||
|
|
|
@ -156,7 +156,6 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
|
|||
upgrade_ansible.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
inventory_file=mock_open().read(),
|
||||
ansible_queue_name=constants.FFWD_UPGRADE_QUEUE,
|
||||
nodes='',
|
||||
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
|
||||
node_user='heat-admin',
|
||||
|
@ -181,7 +180,6 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
|
|||
upgrade_ansible.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
inventory_file=mock_open().read(),
|
||||
ansible_queue_name=constants.FFWD_UPGRADE_QUEUE,
|
||||
nodes='',
|
||||
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
|
||||
node_user='my-user',
|
||||
|
|
|
@ -149,7 +149,6 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
|||
nodes='Compute',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook='fake-playbook.yaml',
|
||||
ansible_queue_name=constants.UPDATE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
@ -179,7 +178,6 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
|||
nodes='Compute',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPDATE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
@ -208,7 +206,6 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
|||
nodes=None,
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPDATE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
|
|
@ -163,7 +163,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||
nodes='Compute, Controller',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook='fake-playbook.yaml',
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
@ -195,7 +194,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||
nodes='Compute',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags='validation'
|
||||
)
|
||||
|
@ -225,7 +223,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||
nodes='compute-0, compute-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook='fake-playbook.yaml',
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
@ -255,7 +252,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||
nodes='swift-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags=''
|
||||
)
|
||||
|
@ -287,7 +283,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||
nodes='swift-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='heat-admin',
|
||||
skip_tags='pre-upgrade,validation'
|
||||
)
|
||||
|
|
|
@ -827,16 +827,15 @@ def get_tripleo_ansible_inventory(inventory_file='',
|
|||
|
||||
|
||||
def run_update_ansible_action(log, clients, nodes, inventory, playbook,
|
||||
queue, all_playbooks, action, ssh_user,
|
||||
skip_tags=''):
|
||||
all_playbooks, action, ssh_user, skip_tags=''):
|
||||
playbooks = [playbook]
|
||||
if playbook == "all":
|
||||
playbooks = all_playbooks
|
||||
for book in playbooks:
|
||||
log.debug("Running ansible playbook %s " % book)
|
||||
action.update_ansible(clients, nodes=nodes, inventory_file=inventory,
|
||||
playbook=book, ansible_queue_name=queue,
|
||||
node_user=ssh_user, skip_tags=skip_tags)
|
||||
playbook=book, node_user=ssh_user,
|
||||
skip_tags=skip_tags)
|
||||
|
||||
|
||||
def prepend_environment(environment_files, templates_dir, environment):
|
||||
|
|
|
@ -67,8 +67,7 @@ class FFWDUpgradePrepare(DeployOvercloud):
|
|||
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)
|
||||
config=constants.FFWD_UPGRADE_PREPARE_SCRIPT, group='script')
|
||||
|
||||
ceph_ansible_playbook = parsed_args.ceph_ansible_playbook
|
||||
# In case of update and upgrade we need to force the
|
||||
|
@ -155,8 +154,8 @@ class FFWDUpgradeRun(command.Command):
|
|||
limit_hosts = ''
|
||||
oooutils.run_update_ansible_action(
|
||||
self.log, clients, limit_hosts, inventory,
|
||||
constants.FFWD_UPGRADE_PLAYBOOK, constants.FFWD_UPGRADE_QUEUE,
|
||||
[], package_update, parsed_args.ssh_user)
|
||||
constants.FFWD_UPGRADE_PLAYBOOK, [], package_update,
|
||||
parsed_args.ssh_user)
|
||||
|
||||
|
||||
class FFWDUpgradeConverge(DeployOvercloud):
|
||||
|
|
|
@ -153,7 +153,7 @@ class UpdateRun(command.Command):
|
|||
inventory = oooutils.get_tripleo_ansible_inventory(
|
||||
parsed_args.static_inventory, parsed_args.ssh_user, stack)
|
||||
oooutils.run_update_ansible_action(self.log, clients, nodes, inventory,
|
||||
playbook, constants.UPDATE_QUEUE,
|
||||
playbook,
|
||||
constants.MINOR_UPDATE_PLAYBOOKS,
|
||||
package_update,
|
||||
parsed_args.ssh_user)
|
||||
|
|
|
@ -202,7 +202,6 @@ class UpgradeRun(command.Command):
|
|||
skip_tags = self._validate_skip_tags(parsed_args.skip_tags)
|
||||
oooutils.run_update_ansible_action(self.log, clients, limit_hosts,
|
||||
inventory, playbook,
|
||||
constants.UPGRADE_QUEUE,
|
||||
constants.MAJOR_UPGRADE_PLAYBOOKS,
|
||||
package_update,
|
||||
parsed_args.ssh_user, skip_tags)
|
||||
|
|
|
@ -77,23 +77,19 @@ def get_config(clients, **workflow_input):
|
|||
def update_ansible(clients, **workflow_input):
|
||||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
ansible_queue = workflow_input['ansible_queue_name']
|
||||
|
||||
with tripleoclients.messaging_websocket(ansible_queue) as update_ws:
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.package_update.v1.update_nodes',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client,
|
||||
update_ws,
|
||||
execution):
|
||||
if payload.get('message'):
|
||||
pprint.pprint(payload['message'].splitlines())
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution):
|
||||
print(payload['message'])
|
||||
|
||||
if payload['status'] == 'SUCCESS':
|
||||
print('Success')
|
||||
print("Success")
|
||||
else:
|
||||
raise RuntimeError('Update failed with: {}'.format(payload))
|
||||
|
||||
|
@ -154,8 +150,7 @@ def ffwd_converge_nodes(clients, **workflow_input):
|
|||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
|
||||
with tripleoclients.messaging_websocket(
|
||||
workflow_input['queue_name']) as ws:
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.package_update.v1.ffwd_upgrade_converge_plan',
|
||||
|
@ -175,8 +170,7 @@ 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:
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.deployment.v1.deploy_on_servers',
|
||||
|
|
Loading…
Reference in New Issue