Use ephemeral Heat by default

Switches to use ephemeral Heat by default for all overcloud operations
and defaults enable_heat to False in undercloud.conf. Stack data will be
migrated to the ephemeral Heat model (to use the consistent working
directory) as part of the upgrade with the inclusion of the depends-on.

To improve the UX when using ephemeral Heat, "stack resource list" is
now run after "stack failures list" automaticaly in the case of Heat
stack failures.

Signed-off-by: James Slagle <jslagle@redhat.com>
Change-Id: I22b2ec530f8b888a94a88e1726792a8afef227ab
(cherry picked from commit 030e9f0b57)
This commit is contained in:
James Slagle 2021-05-05 11:31:08 -04:00
parent 38317489e8
commit 9ae6487b6d
8 changed files with 202 additions and 45 deletions

View File

@ -0,0 +1,10 @@
---
features:
- An ephemeral Heat process is now used by default for overcloud deployment.
On each overcloud management operation (deploy/update/upgrade), a
containerized Heat process will be started, the stack will be created new,
and then the Heat process will be stopped. The enable_heat option is
undercloud.conf is now defaulted to False.
deprecations:
- Setting enable_heat=True in undercloud.conf is deprecated.
- Using --heat-type=installed is deprecated with the openstack overcloud commands.

View File

@ -72,7 +72,7 @@ class UndercloudConfig(StandaloneConfig):
def get_undercloud_service_opts(self): def get_undercloud_service_opts(self):
return super(UndercloudConfig, self).get_enable_service_opts( return super(UndercloudConfig, self).get_enable_service_opts(
cinder=False, cinder=False,
heat=True, heat=False,
ironic=True, ironic=True,
ironic_inspector=True, ironic_inspector=True,
mistral=False, mistral=False,

View File

@ -169,7 +169,7 @@ class TestUndercloudConfig(base.TestCase):
ret = self.config.get_undercloud_service_opts() ret = self.config.get_undercloud_service_opts()
expected = {'enable_cinder': False, expected = {'enable_cinder': False,
'enable_frr': False, 'enable_frr': False,
'enable_heat': True, 'enable_heat': False,
'enable_ironic': True, 'enable_ironic': True,
'enable_ironic_inspector': True, 'enable_ironic_inspector': True,
'enable_mistral': False, 'enable_mistral': False,

View File

@ -75,3 +75,19 @@ class UtilsFixture(fixtures.Fixture):
self.mock_run_ansible_playbook = self.useFixture(fixtures.MockPatch( self.mock_run_ansible_playbook = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.run_ansible_playbook') 'tripleoclient.utils.run_ansible_playbook')
).mock ).mock
self.mock_get_heat_launcher = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.get_heat_launcher')
).mock
self.mock_launch_heat = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.launch_heat')
).mock
self.mock_kill_heat = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.kill_heat')
).mock
self.mock_rm_heat = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.rm_heat')
).mock
self.mock_export_overcloud = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.export_overcloud')
).mock
self.mock_export_overcloud.return_value = {}

View File

@ -118,7 +118,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service') @mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True) @mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
@mock.patch('tripleo_common.utils.plan.default_image_params', @mock.patch('tripleo_common.utils.plan.default_image_params',
autospec=True) autospec=True, return_value={})
@mock.patch('tripleoclient.utils.get_rc_params', @mock.patch('tripleoclient.utils.get_rc_params',
autospec=True) autospec=True)
@mock.patch('tripleo_common.utils.plan.generate_passwords', @mock.patch('tripleo_common.utils.plan.generate_passwords',
@ -169,9 +169,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
orchestration_client.stacks.get.return_value = mock_stack orchestration_client.stacks.get.return_value = mock_stack
utils_fixture = deployment.UtilsFixture() utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
arglist = ['--templates'] arglist = ['--templates',
'--heat-type', 'installed']
verifylist = [ verifylist = [
('templates', '/usr/share/openstack-tripleo-heat-templates/'), ('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('heat_type', 'installed'),
] ]
clients = self.app.client_manager clients = self.app.client_manager
@ -288,9 +290,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
utils_overcloud_fixture = deployment.UtilsOvercloudFixture() utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_overcloud_fixture) self.useFixture(utils_overcloud_fixture)
arglist = ['--templates', '--no-cleanup'] arglist = ['--templates', '--no-cleanup',
'--heat-type', 'installed']
verifylist = [ verifylist = [
('templates', '/usr/share/openstack-tripleo-heat-templates/'), ('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('heat_type', 'installed'),
] ]
mock_stack_data.return_value = {'environment_parameters': {}, mock_stack_data.return_value = {'environment_parameters': {},
'heat_resource_tree': {}} 'heat_resource_tree': {}}
@ -420,7 +424,13 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
} }
mock_get_template_contents.return_value = [{}, "template"] mock_get_template_contents.return_value = [{}, "template"]
mock_process_env.return_value = {}, {} mock_env = {}
mock_env['parameter_defaults'] = {}
mock_env['parameter_defaults']['ContainerHeatApiImage'] = \
'container-heat-api-image'
mock_env['parameter_defaults']['ContainerHeatEngineImage'] = \
'container-heat-engine-image'
mock_process_env.return_value = {}, mock_env
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
baremetal = clients.baremetal baremetal = clients.baremetal
@ -486,9 +496,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
utils_fixture = deployment.UtilsFixture() utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
arglist = ['--templates', '/home/stack/tripleo-heat-templates'] arglist = ['--templates', '/home/stack/tripleo-heat-templates',
'--heat-type', 'installed']
verifylist = [ verifylist = [
('templates', '/home/stack/tripleo-heat-templates'), ('templates', '/home/stack/tripleo-heat-templates'),
('heat_type', 'installed'),
] ]
clients = self.app.client_manager clients = self.app.client_manager
@ -573,6 +585,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.useFixture(fixture) self.useFixture(fixture)
utils_overcloud_fixture = deployment.UtilsOvercloudFixture() utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_overcloud_fixture) self.useFixture(utils_overcloud_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
clients = self.app.client_manager clients = self.app.client_manager
@ -591,6 +605,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'Test': 'OS::Heat::None', 'Test': 'OS::Heat::None',
'resources': {'*': {'*': { 'resources': {'*': {'*': {
'UpdateDeployment': {'hooks': []}}}}}} 'UpdateDeployment': {'hooks': []}}}}}}
env['parameter_defaults']['ContainerHeatApiImage'] = \
'container-heat-api-image'
env['parameter_defaults']['ContainerHeatEngineImage'] = \
'container-heat-engine-image'
mock_process_env.return_value = {}, env mock_process_env.return_value = {}, env
with open(test_env, 'w') as temp_file: with open(test_env, 'w') as temp_file:
@ -612,7 +630,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
env_files_tracker=None, env_files_tracker=None,
deployment_options=None): deployment_options=None):
assertEqual( assertEqual(
{'parameter_defaults': {}, {'parameter_defaults': {
'ContainerHeatApiImage': 'container-heat-api-image',
'ContainerHeatEngineImage': 'container-heat-engine-image',
},
'resource_registry': { 'resource_registry': {
'Test': 'OS::Heat::None', 'Test': 'OS::Heat::None',
'resources': {'*': {'*': { 'resources': {'*': {'*': {
@ -621,7 +642,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_rc_params.return_value = {'password': 'password', mock_rc_params.return_value = {'password': 'password',
'region': 'region1'} 'region': 'region1'}
mock_deploy_heat.side_effect = _fake_heat_deploy mock_deploy_heat.side_effect = _fake_heat_deploy
mock_create_env.return_value = [] mock_create_env.return_value = {}
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
mock_copy.assert_called_once() mock_copy.assert_called_once()
@ -792,7 +813,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
mock_stack = fakes.create_tht_stack() mock_stack = fakes.create_tht_stack()
orchestration_client.stacks.get.return_value = mock_stack orchestration_client.stacks.get.return_value = mock_stack
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
@ -844,7 +867,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.assertTrue(mock_heat_deploy.called) self.assertTrue(mock_heat_deploy.called)
self.assertTrue(utils_fixture.mock_deploy_tht.called) self.assertTrue(utils_oc_fixture.mock_deploy_tht.called)
# Check that Heat was called with correct parameters: # Check that Heat was called with correct parameters:
call_args = mock_heat_deploy.call_args[0] call_args = mock_heat_deploy.call_args[0]
@ -856,7 +879,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertIn('Test', call_args[7]['resource_registry']) self.assertIn('Test', call_args[7]['resource_registry'])
self.assertIn('Test2', call_args[7]['resource_registry']) self.assertIn('Test2', call_args[7]['resource_registry'])
utils_fixture.mock_deploy_tht.assert_called_with( utils_oc_fixture.mock_deploy_tht.assert_called_with(
output_dir=self.cmd.working_dir) output_dir=self.cmd.working_dir)
mock_copy.assert_called_once() mock_copy.assert_called_once()
@ -866,7 +889,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'_provision_networks', autospec=True) '_provision_networks', autospec=True)
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True) @mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
@mock.patch('tripleo_common.utils.plan.default_image_params', @mock.patch('tripleo_common.utils.plan.default_image_params',
autospec=True) autospec=True,
return_value=dict(
ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'))
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True) @mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
@mock.patch('tripleo_common.utils.plan.generate_passwords', @mock.patch('tripleo_common.utils.plan.generate_passwords',
return_value={}) return_value={})
@ -944,6 +970,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
"id": "network id" "id": "network id"
} }
mock_env = fakes.create_env_with_ntp() mock_env = fakes.create_env_with_ntp()
mock_env['parameter_defaults']['ContainerHeatApiImage'] = \
'container-heat-api-image'
mock_env['parameter_defaults']['ContainerHeatEngineImage'] = \
'container-heat-engine-image'
mock_process_env.return_value = [{}, mock_env] mock_process_env.return_value = [{}, mock_env]
mock_get_template_contents.return_value = [{}, "template"] mock_get_template_contents.return_value = [{}, "template"]
@ -973,6 +1003,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'192.168.0.1 uc.ctlplane.localhost uc.ctlplane' '192.168.0.1 uc.ctlplane.localhost uc.ctlplane'
], ],
'CtlplaneNetworkAttributes': {}, 'CtlplaneNetworkAttributes': {},
'ContainerHeatApiImage': 'container-heat-api-image',
'ContainerHeatEngineImage': 'container-heat-engine-image',
} }
def _custom_create_params_env(parameters, tht_root, def _custom_create_params_env(parameters, tht_root,
@ -1009,7 +1041,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_copy, mock_rc_params): mock_copy, mock_rc_params):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
arglist = ['--templates', '--deployed-server', '--disable-validations'] arglist = ['--templates', '--deployed-server', '--disable-validations']
verifylist = [ verifylist = [
@ -1025,13 +1059,16 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
clients.compute = mock.Mock() clients.compute = mock.Mock()
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
mock_create_env.return_value = ({}, []) mock_create_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.assertTrue(mock_deploy.called) self.assertTrue(mock_deploy.called)
self.assertNotCalled(clients.baremetal) self.assertNotCalled(clients.baremetal)
self.assertNotCalled(clients.compute) self.assertNotCalled(clients.compute)
self.assertTrue(utils_fixture.mock_deploy_tht.called) self.assertTrue(utils_oc_fixture.mock_deploy_tht.called)
mock_copy.assert_called_once() mock_copy.assert_called_once()
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True) @mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
@ -1049,7 +1086,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_copy, mock_rc_params): mock_copy, mock_rc_params):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
@ -1063,7 +1102,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
mock_rc_params.return_value = {'password': 'password', mock_rc_params.return_value = {'password': 'password',
'region': 'region1'} 'region': 'region1'}
mock_create_env.return_value = ({}, []) mock_create_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.assertTrue(mock_deploy.called) self.assertTrue(mock_deploy.called)
self.assertTrue(fixture.mock_get_hosts_and_enable_ssh_admin.called) self.assertTrue(fixture.mock_get_hosts_and_enable_ssh_admin.called)
@ -1090,12 +1132,18 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_copy, mock_rc_params): mock_copy, mock_rc_params):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
mock_create_env.return_value = ({}, []) mock_create_env.return_value = ({}, [])
mock_create_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
arglist = ['--templates', '--config-download', '--setup-only'] arglist = ['--templates', '--config-download', '--setup-only']
verifylist = [ verifylist = [
@ -1131,12 +1179,17 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env): mock_create_parameters_env):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
mock_create_parameters_env.return_value = (mock.Mock(), mock.Mock()) mock_create_parameters_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
arglist = ['--templates', '--config-download-only'] arglist = ['--templates', '--config-download-only']
verifylist = [ verifylist = [
@ -1178,10 +1231,15 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env): mock_create_parameters_env):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
mock_create_parameters_env.return_value = (mock.Mock(), mock.Mock()) mock_create_parameters_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
arglist = ['--templates', '--config-download-only'] arglist = ['--templates', '--config-download-only']
verifylist = [ verifylist = [
@ -1220,7 +1278,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_copy, mock_rc_params): mock_copy, mock_rc_params):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
@ -1236,7 +1296,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_rc_params.return_value = {'password': 'password', mock_rc_params.return_value = {'password': 'password',
'region': 'region1'} 'region': 'region1'}
mock_create_env.return_value = ({}, []) mock_create_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.assertTrue(fixture.mock_get_hosts_and_enable_ssh_admin.called) self.assertTrue(fixture.mock_get_hosts_and_enable_ssh_admin.called)
self.assertTrue(fixture.mock_config_download.called) self.assertTrue(fixture.mock_config_download.called)
@ -1282,7 +1345,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env): mock_create_parameters_env):
fixture = deployment.DeploymentWorkflowFixture() fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture) self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture() utils_oc_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_oc_fixture)
utils_fixture = deployment.UtilsFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
clients = self.app.client_manager clients = self.app.client_manager
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
@ -1295,7 +1360,14 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
('templates', '/usr/share/openstack-tripleo-heat-templates/'), ('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('overcloud_ssh_port_timeout', 42), ('timeout', 451) ('overcloud_ssh_port_timeout', 42), ('timeout', 451)
] ]
mock_process_env.return_value = {}, {}
mock_env = {}
mock_env['parameter_defaults'] = {}
mock_env['parameter_defaults']['ContainerHeatApiImage'] = \
'container-heat-api-image'
mock_env['parameter_defaults']['ContainerHeatEngineImage'] = \
'container-heat-engine-image'
mock_process_env.return_value = {}, mock_env
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
mock_rc_params.return_value = {'password': 'password', mock_rc_params.return_value = {'password': 'password',
@ -1303,12 +1375,19 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
# assuming heat deploy consumed a 3m out of total 451m timeout # assuming heat deploy consumed a 3m out of total 451m timeout
with mock.patch('time.time', side_effect=[1585820346, with mock.patch('time.time', side_effect=[1585820346,
12345678, 0, 0, 12345678, 0, 0,
1585820526]): 1585820526, 0]):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.assertIn( self.assertIn([
[mock.call(mock.ANY, mock.ANY, 'overcloud', mock.ANY, mock.call(
mock.ANY, 451, mock.ANY, mock.ANY, False, None, mock.ANY, mock.ANY, 'overcloud', mock.ANY,
deployment_options={}, env_files_tracker=mock.ANY)], mock.ANY, 451, mock.ANY,
{'parameter_defaults': {
'ContainerHeatApiImage': 'container-heat-api-image',
'ContainerHeatEngineImage':
'container-heat-engine-image'}},
False, None,
env_files_tracker=mock.ANY,
deployment_options={})],
mock_hd.mock_calls) mock_hd.mock_calls)
self.assertIn( self.assertIn(
[mock.call(mock.ANY, mock.ANY, mock.ANY, 'ctlplane', [mock.call(mock.ANY, mock.ANY, mock.ANY, 'ctlplane',
@ -1325,6 +1404,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
fixture.mock_config_download.assert_called() fixture.mock_config_download.assert_called()
mock_copy.assert_called_once() mock_copy.assert_called_once()
@mock.patch('tripleoclient.workflows.deployment.create_overcloudrc',
autospec=True)
@mock.patch('tripleoclient.workflows.deployment.make_config_download_dir') @mock.patch('tripleoclient.workflows.deployment.make_config_download_dir')
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True) @mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
@mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.copy_clouds_yaml')
@ -1340,7 +1421,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
def test_config_download_only_timeout( def test_config_download_only_timeout(
self, mock_deploy, mock_create_env, self, mock_deploy, mock_create_env,
mock_get_undercloud_host_entry, mock_update, mock_get_undercloud_host_entry, mock_update,
mock_copyi, mock_rc_params, mock_cd_dir): mock_copyi, mock_rc_params, mock_cd_dir,
mock_create_overcloudrc):
utils_fixture = deployment.UtilsOvercloudFixture() utils_fixture = deployment.UtilsOvercloudFixture()
self.useFixture(utils_fixture) self.useFixture(utils_fixture)
utils_fixture2 = deployment.UtilsFixture() utils_fixture2 = deployment.UtilsFixture()
@ -1351,6 +1433,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
stack.output_show.return_value = {'output': {'output_value': []}} stack.output_show.return_value = {'output': {'output_value': []}}
orchestration_client = clients.orchestration orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = stack orchestration_client.stacks.get.return_value = stack
utils_fixture2.mock_launch_heat.return_value = orchestration_client
arglist = ['--templates', '--config-download-only', arglist = ['--templates', '--config-download-only',
'--overcloud-ssh-port-timeout', '42', '--overcloud-ssh-port-timeout', '42',
@ -1365,7 +1448,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_rc_params.return_value = {'password': 'password', mock_rc_params.return_value = {'password': 'password',
'region': 'region1'} 'region': 'region1'}
mock_create_env.return_value = ({}, []) mock_create_env.return_value = (
dict(ContainerHeatApiImage='container-heat-api-image',
ContainerHeatEngineImage='container-heat-engine-image'),
[])
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
playbook = os.path.join(os.environ.get( playbook = os.path.join(os.environ.get(
'HOME'), self.cmd.working_dir, 'HOME'), self.cmd.working_dir,

View File

@ -92,6 +92,8 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -153,6 +155,8 @@ class TestUndercloudInstall(TestPluginV1):
'/home/stack/foo.yaml', '-e', '/home/stack/foo.yaml', '-e',
'/usertht/environments/services/ironic.yaml', '-e', '/usertht/environments/services/ironic.yaml', '-e',
'/usertht/environments/services/ironic-inspector.yaml', '-e', '/usertht/environments/services/ironic-inspector.yaml', '-e',
'/usertht/environments/'
'disable-heat.yaml', '-e',
'/usertht/environments/services/' '/usertht/environments/services/'
'undercloud-remove-novajoin.yaml', '-e', 'undercloud-remove-novajoin.yaml', '-e',
'/usertht/environments/' '/usertht/environments/'
@ -315,6 +319,8 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -379,6 +385,8 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -439,6 +447,8 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -496,6 +506,8 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -589,6 +601,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -677,6 +691,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -741,6 +757,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -804,6 +822,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -865,6 +885,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',
@ -932,6 +954,8 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e', 'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-heat.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-remove-novajoin.yaml', '-e', 'services/undercloud-remove-novajoin.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/' '/usr/share/openstack-tripleo-heat-templates/environments/'
'disable-telemetry.yaml', '-e', 'disable-telemetry.yaml', '-e',

View File

@ -390,10 +390,6 @@ class DeployOvercloud(command.Command):
# check migration to service vips managed by servce # check migration to service vips managed by servce
utils.check_service_vips_migrated_to_service(stack, env) utils.check_service_vips_migrated_to_service(stack, env)
if parsed_args.heat_type != 'installed':
self.setup_ephemeral_heat(
parsed_args, env.get('parameter_defaults'))
self._try_overcloud_deploy_with_compat_yaml( self._try_overcloud_deploy_with_compat_yaml(
new_tht_root, stack, new_tht_root, stack,
parsed_args.stack, env_files, parsed_args.stack, env_files,
@ -689,17 +685,14 @@ class DeployOvercloud(command.Command):
return [output_path] return [output_path]
def setup_ephemeral_heat(self, parsed_args, parameters): def setup_ephemeral_heat(self, parsed_args):
self.log.info("Using ephemeral heat for stack operation") self.log.info("Using ephemeral heat for stack operation")
api_container_image = parameters['ContainerHeatApiImage']
engine_container_image = \
parameters['ContainerHeatEngineImage']
restore_db = (parsed_args.setup_only or restore_db = (parsed_args.setup_only or
parsed_args.config_download_only) parsed_args.config_download_only)
self.heat_launcher = utils.get_heat_launcher( self.heat_launcher = utils.get_heat_launcher(
parsed_args.heat_type, parsed_args.heat_type,
api_container_image=api_container_image, api_container_image=parsed_args.heat_container_api_image,
engine_container_image=engine_container_image, engine_container_image=parsed_args.heat_container_engine_image,
heat_dir=os.path.join(self.working_dir, heat_dir=os.path.join(self.working_dir,
'heat-launcher'), 'heat-launcher'),
use_tmp_dir=False, use_tmp_dir=False,
@ -1048,7 +1041,7 @@ class DeployOvercloud(command.Command):
parser.add_argument( parser.add_argument(
'--heat-type', '--heat-type',
action='store', action='store',
default='installed', default='pod',
choices=['installed', 'pod', 'container', 'native'], choices=['installed', 'pod', 'container', 'native'],
help=_('The type of Heat process to use to execute ' help=_('The type of Heat process to use to execute '
'the deployment.\n' 'the deployment.\n'
@ -1058,6 +1051,26 @@ class DeployOvercloud(command.Command):
'container: Use an ephemeral Heat container.\n' 'container: Use an ephemeral Heat container.\n'
'native: Use an ephemeral Heat process.') 'native: Use an ephemeral Heat process.')
) )
parser.add_argument(
'--heat-container-api-image',
metavar='<HEAT_CONTAINER_API_IMAGE>',
dest='heat_container_api_image',
default=constants.DEFAULT_HEAT_API_CONTAINER,
help=_('The container image to use when launching the heat-api '
'process. Only used when --heat-type=pod. '
'Defaults to: {}'.format(
constants.DEFAULT_HEAT_API_CONTAINER))
)
parser.add_argument(
'--heat-container-engine-image',
metavar='<HEAT_CONTAINER_ENGINE_IMAGE>',
dest='heat_container_engine_image',
default=constants.DEFAULT_HEAT_ENGINE_CONTAINER,
help=_('The container image to use when launching the heat-engine '
'process. Only used when --heat-type=pod. '
'Defaults to: {}'.format(
constants.DEFAULT_HEAT_ENGINE_CONTAINER))
)
parser.add_argument( parser.add_argument(
'--rm-heat', '--rm-heat',
action='store_true', action='store_true',
@ -1150,6 +1163,13 @@ class DeployOvercloud(command.Command):
created_env_files = self.create_env_files( created_env_files = self.create_env_files(
stack, parsed_args, new_tht_root, user_tht_root) stack, parsed_args, new_tht_root, user_tht_root)
if parsed_args.heat_type != 'installed':
self.setup_ephemeral_heat(parsed_args)
else:
self.log.warning(
("DEPRECATED: Using --heat-type=installed is deprecated "
"and will be removed in a future release."))
try: try:
if not (parsed_args.config_download_only or if not (parsed_args.config_download_only or
parsed_args.setup_only): parsed_args.setup_only):

View File

@ -91,7 +91,8 @@ def deploy_without_plan(clients, stack, stack_name, template,
create_result = utils.wait_for_stack_ready( create_result = utils.wait_for_stack_ready(
orchestration_client, stack_name, marker, action) orchestration_client, stack_name, marker, action)
if not create_result: if not create_result:
shell.OpenStackShell().run(["stack", "failures", "list", stack_name]) shell.OpenStackShell().run(
["stack", "failures", "list", '--long', stack_name])
set_deployment_status( set_deployment_status(
stack_name, stack_name,
status='DEPLOY_FAILED', status='DEPLOY_FAILED',