Derive parameters clean up

This change is to remove derive parameters code for OvS DPDK,
SRIOV and HCI parameters.

Change-Id: Ifca04e4abfec5ceb0b84a57116e529a84d31c96a
This commit is contained in:
Jaganathan Palanisamy 2022-07-27 20:45:08 +05:30
parent 46fa8437fd
commit e5e8450333
5 changed files with 5 additions and 213 deletions

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The derive parameters ``--plan-environment-file`` option of the
``overcloud deploy`` command has been removed.

View File

@ -282,8 +282,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.copy_clouds_yaml')
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True,
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane')
@mock.patch('tripleoclient.workflows.parameters.invoke_plan_env_workflows',
autospec=True)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_postconfig', autospec=True)
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
@ -300,7 +298,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_get_template_contents, mock_validate_args,
mock_validate_vip_file,
mock_breakpoints_cleanup, mock_postconfig,
mock_invoke_plan_env_wf,
mock_get_undercloud_host_entry,
mock_copy, mock_overcloudrc,
mock_get_ctlplane_attrs,
@ -361,7 +358,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_validate_args.assert_called_once_with(parsed_args)
mock_validate_vip_file.assert_not_called()
self.assertFalse(mock_invoke_plan_env_wf.called)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_provision_virtual_ips', autospec=True)

View File

@ -36,110 +36,6 @@ class TestParameterWorkflows(utils.TestCommand):
super(TestParameterWorkflows, self).setUp()
self.app.client_manager.baremetal = mock.Mock()
@mock.patch('yaml.safe_load')
@mock.patch("builtins.open")
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
autospec=True)
def test_invoke_plan_env_workflows_single_playbook(self,
mock_inventory,
mock_playbook,
mock_open,
mock_safe_load):
plan_env_data = {
'name': 'overcloud',
'playbook_parameters': {
'sample-playbook-1.yaml': {
'num_phy_cores_per_numa_node_for_pmd': 2
}
}
}
mock_safe_load.return_value = plan_env_data
parameters.invoke_plan_env_workflows(
self.app.client_manager,
'overcloud',
'the-plan-environment.yaml',
stack_data=mock.Mock(),
role_list=mock.Mock(),
derived_environment_path=mock.Mock()
)
calls = [
mock.call(
playbook='sample-playbook-1.yaml',
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir=mock.ANY,
verbosity=0,
extra_vars_file={
'tripleo_get_flatten_params': {
'stack_data': mock.ANY},
'tripleo_role_list': {'roles': mock.ANY}},
extra_vars={'num_phy_cores_per_numa_node_for_pmd': 2,
'derived_environment_path': mock.ANY}
)
]
mock_playbook.assert_has_calls(calls, any_order=True)
@mock.patch('yaml.safe_load')
@mock.patch("builtins.open")
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
autospec=True)
def test_invoke_plan_env_workflows_multi_playbook(self,
mock_inventory,
mock_playbook,
mock_open,
mock_safe_load):
plan_env_data = {
'name': 'overcloud',
'playbook_parameters': {
'sample-playbook-1.yaml': {
'num_phy_cores_per_numa_node_for_pmd': 2
},
'/playbook/dir-1/sample-playbook-2.yaml': {
'some_opt': 0
}
}
}
mock_safe_load.return_value = plan_env_data
parameters.invoke_plan_env_workflows(
self.app.client_manager,
'overcloud',
'the-plan-environment.yaml',
stack_data=mock.Mock(),
role_list=mock.Mock(),
derived_environment_path=mock.Mock()
)
calls = [
mock.call(
playbook='sample-playbook-1.yaml',
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir=mock.ANY,
verbosity=0,
extra_vars_file={
'tripleo_get_flatten_params': {
'stack_data': mock.ANY},
'tripleo_role_list': {'roles': mock.ANY}},
extra_vars={'num_phy_cores_per_numa_node_for_pmd': 2,
'derived_environment_path': mock.ANY}
),
mock.call(
playbook='sample-playbook-2.yaml',
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir='/playbook/dir-1',
verbosity=0,
extra_vars_file={
'tripleo_get_flatten_params': {
'stack_data': mock.ANY},
'tripleo_role_list': {'roles': mock.ANY}},
extra_vars={'some_opt': 0,
'derived_environment_path': mock.ANY}
)
]
mock_playbook.assert_has_calls(calls, any_order=True)
@mock.patch(
'tripleo_common.utils.stack_parameters.generate_fencing_parameters',
return_value={})

View File

@ -98,7 +98,6 @@ def _validate_args(parsed_args):
_validate_args_environment_dir(parsed_args.environment_directories)
not_found = [x for x in [parsed_args.networks_file,
parsed_args.plan_environment_file,
parsed_args.answers_file,
parsed_args.vip_file]
if x and not os.path.isfile(x)]
@ -330,23 +329,6 @@ class DeployOvercloud(command.Command):
env_files_tracker=env_files_tracker,
cleanup=(not parsed_args.no_cleanup))
# Invokes the workflows specified in plan environment file
if parsed_args.plan_environment_file:
output_path = utils.build_user_env_path(
'derived_parameters.yaml', new_tht_root)
workflow_params.build_derived_params_environment(
self.clients, parsed_args.stack, new_tht_root, env_files,
env_files_tracker, parsed_args.plan_environment_file,
output_path, utils.playbook_verbosity(self=self),
self.working_dir)
created_env_files.append(output_path)
env_files_tracker = []
env_files, env = utils.process_multiple_environments(
created_env_files, new_tht_root, user_tht_root,
env_files_tracker=env_files_tracker,
cleanup=(not parsed_args.no_cleanup))
# Copy the env_files to tmp folder for archiving
utils.copy_env_files(env_files, new_tht_root)
@ -682,10 +664,6 @@ class DeployOvercloud(command.Command):
parser.add_argument(
'--vip-file', dest='vip_file',
help=_('Configuration file describing the network Virtual IPs.'))
parser.add_argument(
'--plan-environment-file', '-p',
help=_('Plan Environment file for derived parameters.')
)
parser.add_argument(
'--no-cleanup', action='store_true',
help=_('Don\'t cleanup temporary files, just log their location')

View File

@ -15,11 +15,8 @@ import os
import re
import yaml
from heatclient.common import template_utils
from tripleo_common.utils import stack_parameters as stk_parameters
from tripleoclient.constants import ANSIBLE_TRIPLEO_PLAYBOOKS
from tripleoclient.constants import OVERCLOUD_YAML_NAME
from tripleoclient.constants import UNUSED_PARAMETER_EXCLUDES_RE
from tripleoclient import exceptions
from tripleoclient import utils
@ -29,86 +26,6 @@ from tripleoclient.workflows import roles
LOG = logging.getLogger(__name__)
def invoke_plan_env_workflows(clients, stack_name, plan_env_file,
stack_data, role_list,
derived_environment_path,
verbosity=0):
"""Invokes the workflows in plan environment file"""
try:
with open(plan_env_file) as pf:
plan_env_data = yaml.safe_load(pf.read())
except IOError as exc:
raise exceptions.PlanEnvWorkflowError('File (%s) is not found: '
'%s' % (plan_env_file, exc))
static_inventory = utils.get_tripleo_ansible_inventory(
ssh_user='heat-admin',
stack=stack_name,
undercloud_connection='local',
return_inventory_file_path=True
)
with utils.TempDirs() as tmp:
for pb, pb_vars in plan_env_data["playbook_parameters"].items():
print(
'Invoking playbook ({}) specified in'
' plan-environment file'.format(pb)
)
LOG.debug(
'Running playbook "{}" with the'
' following options {}.'.format(
pb,
pb_vars
)
)
pb_vars_file = {'tripleo_get_flatten_params': {
'stack_data': stack_data}, 'tripleo_role_list': {
'roles': role_list}}
pb_vars['derived_environment_path'] = derived_environment_path
playbook_dir = os.path.dirname(pb)
if not playbook_dir:
playbook_dir = ANSIBLE_TRIPLEO_PLAYBOOKS
utils.run_ansible_playbook(
playbook=os.path.basename(pb),
inventory=static_inventory,
workdir=tmp,
playbook_dir=playbook_dir,
verbosity=verbosity,
extra_vars=pb_vars,
extra_vars_file=pb_vars_file
)
def build_derived_params_environment(clients, stack_name, tht_root, env_files,
env_files_tracker, plan_env_file,
derived_env_file, verbosity, working_dir):
template_path = os.path.join(tht_root, OVERCLOUD_YAML_NAME)
template_files, template = template_utils.get_template_contents(
template_file=template_path)
files = dict(list(template_files.items()) + list(
env_files.items()))
# Build stack_data
stack_data = utils.build_stack_data(
clients, stack_name, template,
files, env_files_tracker)
# Get role list
role_list = roles.get_roles(clients, stack_name, template, files,
env_files_tracker, working_dir, detail=False,
valid=True)
invoke_plan_env_workflows(
clients,
stack_name,
plan_env_file,
stack_data=stack_data,
role_list=role_list,
derived_environment_path=derived_env_file,
verbosity=verbosity
)
def check_deprecated_parameters(clients, stack_name, template, files,
env_files_tracker, working_dir):
"""Checks for deprecated parameters and adds warning if present.