Merge "Remove --heat-type=installed support" into stable/wallaby

This commit is contained in:
Zuul 2022-05-05 11:56:16 +00:00 committed by Gerrit Code Review
commit 0867e4c387
3 changed files with 20 additions and 66 deletions

View File

@ -0,0 +1,5 @@
---
other:
- The --heat-type argument for openstack overcloud deploy no longer accepts a
value of "installed", as using an undercloud installed Heat to deploy the
overcloud is no longer supported.

View File

@ -181,11 +181,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
orchestration_client.stacks.get.return_value = mock_stack
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture)
arglist = ['--templates',
'--heat-type', 'installed']
arglist = ['--templates']
verifylist = [
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('heat_type', 'installed'),
]
clients = self.app.client_manager
@ -219,7 +217,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'SnmpdReadonlyUserPassword': 'PASSWORD',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'StackAction': 'UPDATE',
'StackAction': 'CREATE',
'UndercloudHostsEntries': [
'192.168.0.1 uc.ctlplane.localhost uc.ctlplane'],
'CtlplaneNetworkAttributes': {},
@ -239,8 +237,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'parameter_defaults': expected_parameters}
self.cmd.take_action(parsed_args)
self.assertTrue(orchestration_client.stacks.update.called)
mock_get_template_contents.assert_called_with(
template_file=mock.ANY)
@ -307,26 +303,15 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.useFixture(utils_fixture)
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_overcloud_fixture)
arglist = ['--templates', '--no-cleanup',
'--heat-type', 'installed']
arglist = ['--templates', '--no-cleanup']
verifylist = [
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('heat_type', 'installed'),
]
mock_stack_data.return_value = {'environment_parameters': {},
'heat_resource_tree': {}}
mock_tmpdir.return_value = self.tmp_dir.path
clients = self.app.client_manager
orchestration_client = clients.orchestration
mock_stack = fakes.create_tht_stack()
orchestration_client.stacks.get.side_effect = \
[None, mock_stack, mock_stack]
def _orch_clt_create(**kwargs):
orchestration_client.stacks.get.return_value = mock_stack
orchestration_client.stacks.create.side_effect = _orch_clt_create
clients.network.api.find_attr.return_value = {
"id": "network id"
@ -353,8 +338,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
with mock.patch('builtins.open', mock_open_context):
self.cmd.take_action(parsed_args)
self.assertTrue(orchestration_client.stacks.create.called)
mock_get_template_contents.assert_called_with(
template_file=mock.ANY)
@ -516,16 +499,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture)
arglist = ['--templates', '/home/stack/tripleo-heat-templates',
'--heat-type', 'installed']
arglist = ['--templates', '/home/stack/tripleo-heat-templates']
verifylist = [
('templates', '/home/stack/tripleo-heat-templates'),
('heat_type', 'installed'),
]
clients = self.app.client_manager
orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
mock_events.return_value = []
clients.network.api.find_attr.return_value = {
@ -550,8 +529,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.parameter_defaults_env_file)
self.cmd.take_action(parsed_args)
self.assertTrue(orchestration_client.stacks.update.called)
mock_get_template_contents.assert_called_with(
template_file=mock.ANY)

View File

@ -83,11 +83,6 @@ class DeployOvercloud(command.Command):
else:
parameters['DeployIdentifier'] = ''
if args.heat_type != 'installed':
heat = None
else:
heat = self.orchestration_client
# Check for existing passwords file
password_params_path = os.path.join(
self.working_dir,
@ -98,6 +93,7 @@ class DeployOvercloud(command.Command):
else:
passwords_env = None
heat = None
password_params = plan_utils.generate_passwords(
None, heat, args.stack, passwords_env=passwords_env)
@ -1029,13 +1025,13 @@ class DeployOvercloud(command.Command):
'--heat-type',
action='store',
default='pod',
choices=['installed', 'pod', 'container', 'native'],
choices=['pod', 'container', 'native'],
help=_('The type of Heat process to use to execute '
'the deployment.\n'
'pod (Default): Use an ephemeral Heat pod.\n'
'installed: Use the system installed Heat.\n'
'container: Use an ephemeral Heat container.\n'
'native: Use an ephemeral Heat process.')
'container (Experimental): Use an ephemeral Heat '
'container.\n'
'native (Experimental): Use an ephemeral Heat process.')
)
parser.add_argument(
'--heat-container-api-image',
@ -1164,34 +1160,13 @@ class DeployOvercloud(command.Command):
self.heat_launcher = None
stack = None
stack_create = None
start = time.time()
if parsed_args.heat_type == 'installed':
stack = utils.get_stack(self.orchestration_client,
parsed_args.stack)
stack_create = stack is None
if stack_create:
self.log.info("No stack found, "
"will be doing a stack create")
else:
self.log.info("Stack found, "
"will be doing a stack update")
new_tht_root, user_tht_root = \
self.create_template_dirs(parsed_args)
created_env_files = self.create_env_files(
stack, parsed_args, new_tht_root, user_tht_root)
if parsed_args.heat_type != 'installed':
ephemeral_heat = True
else:
ephemeral_heat = False
self.log.warning(
("DEPRECATED: Using --heat-type=installed is deprecated "
"and will be removed in a future release."))
# full_deploy means we're doing a full deployment
# e.g., no --*-only args were passed
full_deploy = not (parsed_args.stack_only or parsed_args.setup_only or
@ -1222,8 +1197,7 @@ class DeployOvercloud(command.Command):
# running during later parts of overcloud deploy.
try:
if do_stack:
if ephemeral_heat:
self.setup_ephemeral_heat(parsed_args)
self.setup_ephemeral_heat(parsed_args)
self.deploy_tripleo_heat_templates(
stack, parsed_args, new_tht_root,
@ -1287,7 +1261,7 @@ class DeployOvercloud(command.Command):
)
finally:
if parsed_args.heat_type != 'installed' and self.heat_launcher:
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)
@ -1389,8 +1363,7 @@ class DeployOvercloud(command.Command):
self.log.error(e)
try:
if (parsed_args.heat_type != 'installed' and
parsed_args.config_download):
if parsed_args.config_download:
# Create overcloud export
data = export.export_overcloud(
self.working_dir,
@ -1415,10 +1388,9 @@ class DeployOvercloud(command.Command):
print("Overcloud Deployed {0}".format(deploy_message))
try:
if parsed_args.heat_type != 'installed':
self.log.info("Stopping ephemeral heat.")
utils.kill_heat(self.heat_launcher)
utils.rm_heat(self.heat_launcher, backup_db=True)
self.log.info("Stopping ephemeral heat.")
utils.kill_heat(self.heat_launcher)
utils.rm_heat(self.heat_launcher, backup_db=True)
except Exception as e:
self.log.error('Exception stopping ephemeral Heat')
self.log.error(e)