Set deployment_status during config generation

We should update the deployment status during config
generation using ephemeral heat stack.

As we cleanup the heat/stack at the end, there is no way
to know if the last config generation has failed (no stack).
Also, earlier deployment_status used to check for stack status.

Change-Id: I8b358444b1ce2b31c40a0994ba955c7baab9e6ac
(cherry picked from commit eb3d238d4a)
This commit is contained in:
rabi 2022-04-14 10:25:27 +05:30 committed by Rabi Mishra
parent 559cc8cbba
commit ef6fcc94db
2 changed files with 16 additions and 9 deletions

View File

@ -1365,7 +1365,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
# assuming heat deploy consumed a 3m out of total 451m timeout
with mock.patch('time.time', side_effect=[1585820346,
0, 12345678, 0,
1585820526, 0,
1585820526,
1585820526,
0, 0, 0]):
self.cmd.take_action(parsed_args)
self.assertIn([

View File

@ -1195,6 +1195,12 @@ class DeployOvercloud(command.Command):
# outside the block should require Heat. With ephemeral Heat, the Heat
# pods will be cleaned up in the "finally" clause, such that it's not
# running during later parts of overcloud deploy.
self.log.info("Deploying overcloud.")
deployment.set_deployment_status(
parsed_args.stack,
status='DEPLOYING',
working_dir=self.working_dir)
try:
if do_stack:
self.setup_ephemeral_heat(parsed_args)
@ -1259,13 +1265,20 @@ class DeployOvercloud(command.Command):
verbosity=utils.playbook_verbosity(self=self),
extra_vars=extra_vars
)
except (BaseException, Exception):
with excutils.save_and_reraise_exception():
deploy_status = 'DEPLOY_FAILED'
deploy_message = 'with error'
deployment.set_deployment_status(
parsed_args.stack,
status=deploy_status,
working_dir=self.working_dir)
finally:
if self.heat_launcher:
self.log.info("Stopping ephemeral heat.")
utils.kill_heat(self.heat_launcher)
utils.rm_heat(self.heat_launcher, backup_db=True)
try:
if do_setup:
deployment.get_hosts_and_enable_ssh_admin(
@ -1289,13 +1302,6 @@ class DeployOvercloud(command.Command):
raise exceptions.DeploymentError(
'Deployment timed out after %sm' % used)
self.log.info("Deploying overcloud configuration")
deployment.set_deployment_status(
parsed_args.stack,
status='DEPLOYING',
working_dir=self.working_dir
)
deployment_options = {}
if parsed_args.deployment_python_interpreter:
deployment_options['ansible_python_interpreter'] = \