diff --git a/releasenotes/notes/inflight-validation-option-9e3f70b5bcb8dea9.yaml b/releasenotes/notes/inflight-validation-option-9e3f70b5bcb8dea9.yaml new file mode 100644 index 000000000..8dcadaf19 --- /dev/null +++ b/releasenotes/notes/inflight-validation-option-9e3f70b5bcb8dea9.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Introduce new "--inflight-validations" option in order to activate + those validations. It defaults to "False", since we don't want them by + default. diff --git a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py index df113b4eb..af49a6c37 100644 --- a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py +++ b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py @@ -853,8 +853,7 @@ class TestDeployUndercloud(TestPluginV1): @mock.patch('os.execvp') def test_launch_ansible_with_args(self, mock_execvp, mock_chdir, mock_run): - args = ['deploy_steps_playbook.yaml', '--skip-tags', - 'validation'] + args = ['--skip-tags', 'validation'] self.cmd._launch_ansible('/tmp', args, operation='deploy') mock_chdir.assert_called_once() mock_run.assert_called_once_with(self.cmd.log, [ diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 2805bca4d..4f65d2ad4 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -730,6 +730,16 @@ class DeployOvercloud(command.Command): 'use the --run-validations flag. These validations are ' 'now run via the external validations in ' 'tripleo-validations.')) + parser.add_argument( + '--inflight-validations', + action='store_true', + default=False, + dest='inflight', + help=_('Activate in-flight validations during the deploy. ' + 'In-flight validations provide a robust way to ensure ' + 'deployed services are running right after their ' + 'activation. Defaults to False.') + ) parser.add_argument( '--dry-run', action='store_true', @@ -974,9 +984,6 @@ class DeployOvercloud(command.Command): deployment_options['ansible_python_interpreter'] = \ parsed_args.deployment_python_interpreter - disabled_val = parsed_args.disable_validations - enable_val = parsed_args.run_validations - deployment.config_download( self.log, self.clients, stack, parsed_args.templates, parsed_args.overcloud_ssh_user, @@ -987,7 +994,7 @@ class DeployOvercloud(command.Command): timeout, verbosity=self.app_args.verbose_level, deployment_options=deployment_options, - in_flight_validations=(enable_val or not disabled_val)) + in_flight_validations=parsed_args.inflight) except Exception: deployment.set_deployment_status( self.clients, 'failed', diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 2ee4409ff..ff886985d 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -859,14 +859,17 @@ class Deploy(command.Command): return self.tmp_ansible_dir # Never returns, calls exec() - def _launch_ansible(self, ansible_dir, list_args=None, operation="deploy"): + def _launch_ansible(self, ansible_dir, extra_args=None, + operation="deploy"): - if list_args is None: - if operation not in constants.DEPLOY_ANSIBLE_ACTIONS.keys(): - self.log.error(_('Operation %s is not allowed') % operation) - raise exceptions.DeploymentError('Invalid operation to run in ' - 'ansible.') - list_args = constants.DEPLOY_ANSIBLE_ACTIONS[operation].split() + if operation not in constants.DEPLOY_ANSIBLE_ACTIONS.keys(): + self.log.error(_('Operation %s is not allowed') % operation) + raise exceptions.DeploymentError('Invalid operation to run in ' + 'ansible.') + list_args = constants.DEPLOY_ANSIBLE_ACTIONS[operation].split() + + if extra_args: + list_args.extend(extra_args) self.log.warning(_('** Running ansible %s tasks **') % operation) os.chdir(ansible_dir) @@ -1049,6 +1052,16 @@ class Deploy(command.Command): 'openstack stack list\n ' 'where 8006 is the port specified by --heat-api-port.') ) + parser.add_argument( + '--inflight-validations', + action='store_true', + default=False, + dest='inflight', + help=_('Activate in-flight validations during the deploy. ' + 'In-flight validations provide a robust way to ensure ' + 'deployed services are running right after their ' + 'activation. Defaults to False.') + ) stack_action_group = parser.add_mutually_exclusive_group() @@ -1241,6 +1254,9 @@ class Deploy(command.Command): _('Using the existing %s for deployment') % ansible_config) shutil.copy(ansible_config, self.ansible_dir) + extra_args = [] + if not parsed_args.inflight: + extra_args = ['--skip-tags', 'opendev-validation'] # Kill heat, we're done with it now. if not parsed_args.keep_running: self._kill_heat(parsed_args) @@ -1248,7 +1264,8 @@ class Deploy(command.Command): if parsed_args.upgrade: # Run Upgrade tasks before the deployment rc = self._launch_ansible(self.ansible_dir, - operation='upgrade') + operation='upgrade', + extra_args=extra_args) if rc != 0: raise exceptions.DeploymentError('Upgrade failed') rc = self._launch_ansible(self.ansible_dir) @@ -1257,12 +1274,14 @@ class Deploy(command.Command): if parsed_args.upgrade: # Run Post Upgrade tasks after the deployment rc = self._launch_ansible(self.ansible_dir, - operation='post-upgrade') + operation='post-upgrade', + extra_args=extra_args) if rc != 0: raise exceptions.DeploymentError('Post Upgrade failed') # Run Online Upgrade tasks after the deployment rc = self._launch_ansible(self.ansible_dir, - operation='online-upgrade') + operation='online-upgrade', + extra_args=extra_args) if rc != 0: raise exceptions.DeploymentError( 'Online Upgrade failed') diff --git a/tripleoclient/v1/undercloud_config.py b/tripleoclient/v1/undercloud_config.py index 8cdb37085..fc413c067 100644 --- a/tripleoclient/v1/undercloud_config.py +++ b/tripleoclient/v1/undercloud_config.py @@ -742,7 +742,8 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False, utils.ansible_symlink() undercloud_preflight.check(verbose_level, upgrade) deploy_args += ['-e', os.path.join( - tht_templates, "environments/tripleo-validations.yaml")] + tht_templates, "environments/tripleo-validations.yaml"), + '--inflight-validations'] if CONF.get('custom_env_files'): for custom_file in CONF['custom_env_files']: diff --git a/tripleoclient/workflows/deployment.py b/tripleoclient/workflows/deployment.py index a2c682c8e..01ac138fe 100644 --- a/tripleoclient/workflows/deployment.py +++ b/tripleoclient/workflows/deployment.py @@ -313,7 +313,7 @@ def config_download(log, clients, stack, templates, ssh_user, ssh_key, ssh_network, output_dir, override_ansible_cfg, timeout, verbosity=1, deployment_options={}, - in_flight_validations=True): + in_flight_validations=False): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient