Merge "Use a single queue for update/upgrade"

This commit is contained in:
Zuul 2019-01-18 04:11:58 +00:00 committed by Gerrit Code Review
commit 4130ffc84f
13 changed files with 13 additions and 45 deletions

View File

@ -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'

View File

@ -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='',

View File

@ -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='',

View File

@ -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',

View File

@ -148,7 +148,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=''
@ -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='tripleo-admin',
tags='',
skip_tags=''
@ -209,7 +207,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=''

View File

@ -168,7 +168,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=''
@ -201,7 +200,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'
@ -232,7 +230,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=''
@ -263,7 +260,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=''
@ -296,7 +292,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'

View File

@ -1037,16 +1037,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)

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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,

View File

@ -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',