Update Heat stack on update/upgrade/ffwd converge

Removing no-ops from plan only will have no effect, we need to let
Heat know about the no-ops removal too. Client commands always fully
recreate the plan in swift, so any plan edits need to be immediately
applied.

For the same reason this commit also drops execution of the workfow --
so far we thought it's just superfluous (does what the env file did),
but in fact can't have any effect at all, so let's not execute that
code at all.

Depends-On: I9039db99f43e8ad091ea6fef7e3a149fcddf1334
Change-Id: Ife57bfae034f70e33bb64cfc3f3063b6a5528cc6
Closes-Bug: #1768586
(cherry picked from commit a0006df544)
This commit is contained in:
Jiri Stransky 2018-05-02 17:58:58 +02:00
parent c7b7b4e3dc
commit 1dec392c4c
5 changed files with 25 additions and 77 deletions

View File

@ -190,33 +190,10 @@ class TestFFWDUpgradeConverge(fakes.TestFFWDUpgradeConverge):
app_args.verbose_level = 1
self.cmd = overcloud_ffwd_upgrade.FFWDUpgradeConverge(self.app,
app_args)
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
self.mock_uuid4 = uuid4_patcher.start()
self.addCleanup(self.mock_uuid4.stop)
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
@mock.patch('tripleoclient.utils.get_stack', autospec=True)
@mock.patch('tripleoclient.workflows.package_update.ffwd_converge_nodes',
autospec=True)
@mock.patch('os.path.expanduser')
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch('six.moves.builtins.open')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_tripleo_heat_templates_tmpdir', autospec=True)
def test_ffwd_upgrade_converge(
self,
mock_deploy,
mock_open,
mock_execute,
mock_expanduser,
ffwd_converge_nodes,
mock_get_stack,
mock_prepend_env):
mock_expanduser.return_value = '/home/fake/'
mock_stack = mock.Mock()
mock_stack.stack_name = 'le_overcloud'
mock_get_stack.return_value = mock_stack
@mock.patch(
'tripleoclient.v1.overcloud_deploy.DeployOvercloud.take_action')
def test_ffwd_upgrade_converge(self, deploy_action):
argslist = ['--stack', 'le_overcloud', '--templates', '--yes']
verifylist = [
('stack', 'le_overcloud'),
@ -224,10 +201,13 @@ class TestFFWDUpgradeConverge(fakes.TestFFWDUpgradeConverge):
('yes', True)
]
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
with mock.patch('os.path.exists') as mock_exists:
with mock.patch('os.path.exists') as mock_exists, \
mock.patch('os.path.isfile') as mock_isfile:
mock_exists.return_value = True
mock_isfile.return_value = True
self.cmd.take_action(parsed_args)
ffwd_converge_nodes.assert_called_once_with(
self.app.client_manager,
queue_name=constants.FFWD_UPGRADE_QUEUE,
container='le_overcloud')
assert('/usr/share/openstack-tripleo-heat-templates/'
'environments/lifecycle/ffwd-upgrade-converge.yaml'
in parsed_args.environment_files)
deploy_action.assert_called_once_with(parsed_args)

View File

@ -240,14 +240,9 @@ class TestOvercloudUpdateConverge(fakes.TestOvercloudUpdateConverge):
app_args.verbose_level = 1
self.cmd = overcloud_update.UpdateConverge(self.app, app_args)
@mock.patch('tripleoclient.utils.get_stack')
@mock.patch('tripleoclient.workflows.package_update.update_converge_nodes')
@mock.patch(
'tripleoclient.v1.overcloud_deploy.DeployOvercloud.take_action')
def test_update_converge(self, deploy_action, converge_workflow,
get_stack):
get_stack.return_value.stack_name = 'cloud'
def test_update_converge(self, deploy_action):
argslist = ['--templates', '--stack', 'cloud']
verifylist = [
('stack', 'cloud')
@ -263,6 +258,3 @@ class TestOvercloudUpdateConverge(fakes.TestOvercloudUpdateConverge):
'environments/lifecycle/update-converge.yaml'
in parsed_args.environment_files)
deploy_action.assert_called_once_with(parsed_args)
converge_workflow.assert_called_once_with(
self.app.client_manager, container='cloud',
queue_name='update')

View File

@ -164,11 +164,11 @@ class FFWDUpgradeConverge(DeployOvercloud):
"""Converge the fast-forward upgrade on Overcloud Nodes
This is the last step for completion of a fast forward upgrade.
There is no heat stack update performed here. The main task is updating
the plan to unblock future stack updates. For the ffwd upgrade workflow
we have set and used the config-download Software/Structured Deployment
for the OS::TripleO and OS::Heat resources. This unsets those back
to their default values, in the swift stored plan.
The main task is updating the plan and stack to unblock future
stack updates. For the ffwd upgrade workflow we have set and
used the config-download Software/Structured Deployment for the
OS::TripleO and OS::Heat resources. This unsets those back to
their default values.
"""
log = logging.getLogger(__name__ + ".FFWDUpgradeConverge")
@ -187,13 +187,6 @@ class FFWDUpgradeConverge(DeployOvercloud):
self.log.debug("take_action(%s)" % parsed_args)
oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log)
clients = self.app.client_manager
stack = oooutils.get_stack(clients.orchestration,
parsed_args.stack)
stack_name = stack.stack_name
parsed_args.update_plan_only = True
# Add the converge environment into the args to unset noop etc
templates_dir = (parsed_args.templates or
constants.TRIPLEO_HEAT_TEMPLATES)
@ -204,9 +197,5 @@ class FFWDUpgradeConverge(DeployOvercloud):
constants.FFWD_UPGRADE_CONVERGE_ENV)
super(FFWDUpgradeConverge, self).take_action(parsed_args)
# Run converge steps
package_update.ffwd_converge_nodes(
clients, container=stack_name,
queue_name=constants.FFWD_UPGRADE_QUEUE)
print("FFWD Upgrade Converge on stack {0} complete.".format(
parsed_args.stack))

View File

@ -171,21 +171,14 @@ class UpdateRun(command.Command):
class UpdateConverge(DeployOvercloud):
"""Converge the update on Overcloud nodes.
This restores the plan environment so that normal deployment
workflow is back in place. The action does not perform a Heat
stack update.
This restores the plan and stack so that normal deployment
workflow is back in place.
"""
log = logging.getLogger(__name__ + ".UpdateConverge")
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
clients = self.app.client_manager
stack_name = oooutils.get_stack(
clients.orchestration, parsed_args.stack).stack_name
# Only update plan, do not perform stack update.
parsed_args.update_plan_only = True
# Add the update-converge.yaml environment to unset noops
templates_dir = (parsed_args.templates or
@ -195,7 +188,5 @@ class UpdateConverge(DeployOvercloud):
constants.UPDATE_CONVERGE_ENV)
super(UpdateConverge, self).take_action(parsed_args)
package_update.update_converge_nodes(
clients, container=stack_name, queue_name=constants.UPDATE_QUEUE)
print("Update converge on stack {0} complete.".format(
parsed_args.stack))

View File

@ -225,11 +225,11 @@ class UpgradeRun(command.Command):
class UpgradeConvergeOvercloud(DeployOvercloud):
"""Major upgrade converge - reset Heat resources in the stored plan
This is the last step for completion of a overcloud major upgrade.
There is no heat stack update performed here. The main task is updating
the plan to unblock future stack updates. For the major upgrade workflow
we have set specific values for some stack Heat resources. This unsets
those back to their default values, in the swift stored plan.
This is the last step for completion of a overcloud major
upgrade. The main task is updating the plan and stack to
unblock future stack updates. For the major upgrade workflow we
have set specific values for some stack Heat resources. This
unsets those back to their default values.
"""
log = logging.getLogger(__name__ + ".UpgradeConvergeOvercloud")
@ -244,9 +244,7 @@ class UpgradeConvergeOvercloud(DeployOvercloud):
stack = oooutils.get_stack(clients.orchestration,
parsed_args.stack)
stack_name = stack.stack_name
parsed_args.update_plan_only = True
# Add the converge environment into the args to unset noop etc
templates_dir = (parsed_args.templates or
constants.TRIPLEO_HEAT_TEMPLATES)
@ -255,7 +253,5 @@ class UpgradeConvergeOvercloud(DeployOvercloud):
constants.UPGRADE_CONVERGE_ENV)
super(UpgradeConvergeOvercloud, self).take_action(parsed_args)
# Run converge steps
package_update.converge_nodes(clients, container=stack_name)
print("Completed Overcloud Upgrade Converge for stack {0}".format(
stack_name))
stack.stack_name))