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 Change-Id: I8b04c2a39d35f530467ddb5f2c4305c08cbc44f1 Closes-Bug: #1804812
This commit is contained in:
parent
9ef0a30584
commit
c0a57210b9
@ -39,12 +39,7 @@ DEFAULT_ENV_DIRECTORY = os.path.join(os.environ.get('HOME'),
|
||||
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'
|
||||
EXTERNAL_UPDATE_QUEUE = 'externalupdate'
|
||||
EXTERNAL_UPGRADE_QUEUE = 'externalupgrade'
|
||||
|
||||
STACK_TIMEOUT = 240
|
||||
|
||||
IRONIC_HTTP_BOOT_BIND_MOUNT = '/var/lib/ironic/httpboot'
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import mock
|
||||
|
||||
from tripleoclient import constants
|
||||
from tripleoclient.tests.v1.overcloud_external_update import fakes
|
||||
from tripleoclient.v1 import overcloud_external_update
|
||||
|
||||
@ -59,7 +58,6 @@ class TestOvercloudExternalUpdateRun(fakes.TestOvercloudExternalUpdateRun):
|
||||
nodes='all',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook='external_update_steps_playbook.yaml',
|
||||
ansible_queue_name=constants.EXTERNAL_UPDATE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='ceph',
|
||||
skip_tags='',
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import mock
|
||||
|
||||
from tripleoclient import constants
|
||||
from tripleoclient.tests.v1.overcloud_external_upgrade import fakes
|
||||
from tripleoclient.v1 import overcloud_external_upgrade
|
||||
|
||||
@ -59,7 +58,6 @@ class TestOvercloudExternalUpgradeRun(fakes.TestOvercloudExternalUpgradeRun):
|
||||
nodes='all',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook='external_upgrade_steps_playbook.yaml',
|
||||
ansible_queue_name=constants.EXTERNAL_UPGRADE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='ceph',
|
||||
skip_tags='',
|
||||
|
@ -164,7 +164,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',
|
||||
@ -190,7 +189,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',
|
||||
|
@ -142,7 +142,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',
|
||||
tags='',
|
||||
skip_tags=''
|
||||
@ -173,7 +172,6 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
||||
nodes='Compute',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPDATE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags=''
|
||||
@ -203,7 +201,6 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
||||
nodes='compute-0, compute-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPDATE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags=''
|
||||
|
@ -162,7 +162,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',
|
||||
tags='',
|
||||
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='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags='validation'
|
||||
@ -226,7 +224,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='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags=''
|
||||
@ -257,7 +254,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
||||
nodes='swift-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags=''
|
||||
@ -290,7 +286,6 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
||||
nodes='swift-1',
|
||||
inventory_file=mock_open().read(),
|
||||
playbook=book,
|
||||
ansible_queue_name=constants.UPGRADE_QUEUE,
|
||||
node_user='tripleo-admin',
|
||||
tags='',
|
||||
skip_tags='pre-upgrade,validation'
|
||||
|
@ -1027,16 +1027,15 @@ def process_multiple_environments(created_env_files, tht_root,
|
||||
|
||||
|
||||
def run_update_ansible_action(log, clients, nodes, inventory, playbook,
|
||||
queue, all_playbooks, action, ssh_user,
|
||||
tags='', skip_tags=''):
|
||||
all_playbooks, action, ssh_user, tags='',
|
||||
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, tags=tags,
|
||||
playbook=book, node_user=ssh_user, tags=tags,
|
||||
skip_tags=skip_tags)
|
||||
|
||||
|
||||
|
@ -94,7 +94,6 @@ class ExternalUpdateRun(command.Command):
|
||||
playbook = 'all'
|
||||
oooutils.run_update_ansible_action(
|
||||
self.log, clients, limit_hosts, inventory, playbook,
|
||||
constants.EXTERNAL_UPDATE_QUEUE,
|
||||
constants.EXTERNAL_UPDATE_PLAYBOOKS,
|
||||
package_update, parsed_args.ssh_user,
|
||||
tags=parsed_args.tags, skip_tags=parsed_args.skip_tags)
|
||||
|
@ -94,7 +94,6 @@ class ExternalUpgradeRun(command.Command):
|
||||
playbook = 'all'
|
||||
oooutils.run_update_ansible_action(
|
||||
self.log, clients, limit_hosts, inventory, playbook,
|
||||
constants.EXTERNAL_UPGRADE_QUEUE,
|
||||
constants.EXTERNAL_UPGRADE_PLAYBOOKS,
|
||||
package_update, parsed_args.ssh_user,
|
||||
tags=parsed_args.tags, skip_tags=parsed_args.skip_tags)
|
||||
|
@ -65,8 +65,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')
|
||||
|
||||
# In case of update and upgrade we need to force the
|
||||
# update_plan_only. The heat stack update is done by the
|
||||
@ -156,8 +155,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,6 @@ class UpdateRun(command.Command):
|
||||
parsed_args.static_inventory, parsed_args.ssh_user, stack)
|
||||
oooutils.run_update_ansible_action(self.log, clients, limit_hosts,
|
||||
inventory, playbook,
|
||||
constants.UPDATE_QUEUE,
|
||||
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,
|
||||
|
@ -81,24 +81,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,
|
||||
_WORKFLOW_TIMEOUT):
|
||||
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))
|
||||
|
||||
@ -161,8 +156,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',
|
||||
@ -183,8 +177,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…
x
Reference in New Issue
Block a user