Switch --use-heat to take a boolean and deprecate it
--use-heat parameter is deprecated in Rocky cycle and will be removed in the future. When --use-heat / --use-heat=True is set, the undercloud will be containerized and a warning will be shown for the deprecation. When --use-heat=False is set, the undercloud won't be containerized. This allows the case where someone wants to deploy a non-containerized undercloud even if it's not the recommended way in Rocky. Co-Authored-By: Alex Schultz <aschultz@redhat.com> Change-Id: Ibc6fb33d752346d6f8b3a61d74e0bc73c1ac20e3
This commit is contained in:
parent
e5ce9a836e
commit
f6cb7d86ba
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
deprecations:
|
||||
- |
|
||||
--use-heat parameter is deprecated in Rocky cycle and will be removed in
|
||||
the future.
|
||||
When --use-heat / --use-heat=True is set, the undercloud will be
|
||||
containerized and a warning will be shown for the deprecation.
|
||||
When --use-heat=False is set, the undercloud won't be containerized.
|
|
@ -48,7 +48,7 @@ class TestUndercloudInstall(TestPluginV1):
|
|||
self.cmd = undercloud.InstallUndercloud(self.app, app_args)
|
||||
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_install(self, mock_subprocess):
|
||||
def test_undercloud_install_default(self, mock_subprocess):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
@ -58,6 +58,17 @@ class TestUndercloudInstall(TestPluginV1):
|
|||
|
||||
mock_subprocess.assert_called_with(['instack-install-undercloud'])
|
||||
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_install_with_heat_disabled(self, mock_subprocess):
|
||||
arglist = ['--use-heat=False']
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_subprocess.assert_called_with(['instack-install-undercloud'])
|
||||
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
|
@ -337,6 +348,65 @@ class TestUndercloudInstall(TestPluginV1):
|
|||
'/usr/share/openstack-tripleo-heat-templates/'
|
||||
'undercloud-stack-vstate-dropin.yaml'])
|
||||
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_install_with_heat_true(self, mock_subprocess,
|
||||
mock_wr,
|
||||
mock_os, mock_copy,
|
||||
mock_open):
|
||||
self.conf.config(undercloud_log_file='/foo/bar')
|
||||
arglist = ['--use-heat=True', '--no-validations']
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_subprocess.assert_called_with(
|
||||
['sudo', 'openstack', 'tripleo', 'deploy', '--standalone',
|
||||
'--standalone-role', 'Undercloud', '--stack', 'undercloud',
|
||||
'--local-domain=localdomain',
|
||||
'--local-ip=192.168.24.1/24',
|
||||
'--templates=/usr/share/openstack-tripleo-heat-templates/',
|
||||
'--heat-native', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'docker.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/ironic.yaml',
|
||||
'-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/ironic-inspector.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/mistral.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/zaqar.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/tripleo-ui.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/tempest.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'public-tls-undercloud.yaml',
|
||||
'--public-virtual-ip', '192.168.24.2',
|
||||
'--control-virtual-ip', '192.168.24.3', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'ssl/tls-endpoints-public-ip.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'use-dns-for-vips.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/undercloud-haproxy.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/undercloud-keepalived.yaml',
|
||||
'--output-dir=/home/stack', '--cleanup',
|
||||
'-e', '/home/stack/tripleo-config-generated-env-files/'
|
||||
'undercloud_parameters.yaml', '--log-file=/foo/bar', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/'
|
||||
'undercloud-stack-vstate-dropin.yaml'])
|
||||
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
|
@ -415,7 +485,8 @@ class TestUndercloudUpgrade(TestPluginV1):
|
|||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_upgrade(self, mock_subprocess, mock_wr, mock_os):
|
||||
def test_undercloud_upgrade_default(self, mock_subprocess, mock_wr,
|
||||
mock_os):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
@ -434,13 +505,36 @@ class TestUndercloudUpgrade(TestPluginV1):
|
|||
]
|
||||
)
|
||||
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_upgrade_with_heat_disabled(self, mock_subprocess,
|
||||
mock_wr, mock_os):
|
||||
arglist = ['--use-heat=False']
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_subprocess.assert_has_calls(
|
||||
[
|
||||
mock.call(['sudo', 'yum', 'update', '-y',
|
||||
'instack-undercloud']),
|
||||
mock.call('instack-pre-upgrade-undercloud'),
|
||||
mock.call('instack-upgrade-undercloud'),
|
||||
mock.call(['sudo', 'systemctl', 'restart',
|
||||
'openstack-nova-api'])
|
||||
]
|
||||
)
|
||||
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_upgrade_with_heat(self, mock_subprocess,
|
||||
mock_wr,
|
||||
mock_os, mock_copy):
|
||||
def test_undercloud_upgrade_with_heat_enabled(self, mock_subprocess,
|
||||
mock_wr,
|
||||
mock_os, mock_copy):
|
||||
arglist = ['--use-heat', '--no-validations']
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
@ -494,6 +588,66 @@ class TestUndercloudUpgrade(TestPluginV1):
|
|||
'/usr/share/openstack-tripleo-heat-templates/'
|
||||
'undercloud-stack-vstate-dropin.yaml'])
|
||||
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
@mock.patch('subprocess.check_call', autospec=True)
|
||||
def test_undercloud_upgrade_with_heat_true(self, mock_subprocess,
|
||||
mock_wr,
|
||||
mock_os, mock_copy):
|
||||
arglist = ['--use-heat=True', '--no-validations']
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_subprocess.assert_called_with(
|
||||
['sudo', 'openstack', 'tripleo', 'deploy', '--standalone',
|
||||
'--standalone-role', 'Undercloud', '--stack', 'undercloud',
|
||||
'--local-domain=localdomain',
|
||||
'--local-ip=192.168.24.1/24',
|
||||
'--templates=/usr/share/openstack-tripleo-heat-templates/',
|
||||
'--upgrade', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'lifecycle/undercloud-upgrade-prepare.yaml',
|
||||
'--heat-native', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'docker.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/ironic.yaml',
|
||||
'-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/ironic-inspector.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/mistral.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/zaqar.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/tripleo-ui.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/tempest.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'public-tls-undercloud.yaml',
|
||||
'--public-virtual-ip', '192.168.24.2',
|
||||
'--control-virtual-ip', '192.168.24.3', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'ssl/tls-endpoints-public-ip.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'use-dns-for-vips.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/undercloud-haproxy.yaml', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/environments/'
|
||||
'services/undercloud-keepalived.yaml',
|
||||
'--output-dir=/home/stack', '--cleanup',
|
||||
'-e', '/home/stack/tripleo-config-generated-env-files/'
|
||||
'undercloud_parameters.yaml',
|
||||
'--log-file=install-undercloud.log', '-e',
|
||||
'/usr/share/openstack-tripleo-heat-templates/'
|
||||
'undercloud-stack-vstate-dropin.yaml'])
|
||||
|
||||
@mock.patch('shutil.copy')
|
||||
@mock.patch('os.mkdir')
|
||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||
|
|
|
@ -45,10 +45,12 @@ class InstallUndercloud(command.Command):
|
|||
parser.add_argument(
|
||||
'--use-heat',
|
||||
dest='use_heat',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_("Perform undercloud deploy using ephemeral (one-time "
|
||||
"create and forget) heat stack and ansible."),
|
||||
nargs='?',
|
||||
default=None,
|
||||
const="true",
|
||||
help=_('This option is deprecated in Rocky. It makes sure that we '
|
||||
'perform undercloud deploy using ephemeral '
|
||||
'(one-time create and forget) heat stack and ansible.'),
|
||||
)
|
||||
parser.add_argument('--force-stack-update',
|
||||
dest='force_stack_update',
|
||||
|
@ -86,7 +88,18 @@ class InstallUndercloud(command.Command):
|
|||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
utils.ensure_run_as_normal_user()
|
||||
if parsed_args.use_heat:
|
||||
if parsed_args.use_heat is not None:
|
||||
self.log.warning('--use-heat is deprecated in Rocky')
|
||||
# NOTE(EmilienM): For backwards compatibility until CI has been
|
||||
# switched we need to still run instack-undercloud when --use-heat
|
||||
# is not provided. This will be removed in a follow up patch
|
||||
# once CI has been converted to pass in --use-heat=False
|
||||
if parsed_args.use_heat is None or \
|
||||
parsed_args.use_heat.lower() == "false":
|
||||
self.log.warning(_('Non-containerized undercloud deployment is '
|
||||
'deprecated in Rocky cycle.'))
|
||||
cmd = ["instack-install-undercloud"]
|
||||
else:
|
||||
no_validations = parsed_args.dry_run or parsed_args.no_validations
|
||||
cmd = undercloud_config.\
|
||||
prepare_undercloud_deploy(
|
||||
|
@ -94,10 +107,6 @@ class InstallUndercloud(command.Command):
|
|||
verbose_level=self.app_args.verbose_level,
|
||||
force_stack_update=parsed_args.force_stack_update,
|
||||
dry_run=parsed_args.dry_run)
|
||||
else:
|
||||
self.log.warning(_('Non-containerized undercloud deployment is '
|
||||
'deprecated in Rocky cycle.'))
|
||||
cmd = ["instack-install-undercloud"]
|
||||
|
||||
self.log.warning("Running: %s" % ' '.join(cmd))
|
||||
if not parsed_args.dry_run:
|
||||
|
@ -119,18 +128,14 @@ class UpgradeUndercloud(InstallUndercloud):
|
|||
self.log.debug("take action(%s)" % parsed_args)
|
||||
|
||||
utils.ensure_run_as_normal_user()
|
||||
if parsed_args.use_heat:
|
||||
cmd = undercloud_config.\
|
||||
prepare_undercloud_deploy(
|
||||
upgrade=True,
|
||||
yes=parsed_args.yes,
|
||||
no_validations=parsed_args.
|
||||
no_validations,
|
||||
verbose_level=self.app_args.verbose_level,
|
||||
force_stack_update=parsed_args.force_stack_update)
|
||||
self.log.warning("Running: %s" % ' '.join(cmd))
|
||||
subprocess.check_call(cmd)
|
||||
else:
|
||||
if parsed_args.use_heat is not None:
|
||||
self.log.warning('--use-heat is deprecated in Rocky')
|
||||
# NOTE(EmilienM): For backwards compatibility until CI has been
|
||||
# switched we need to still run instack-undercloud when --use-heat
|
||||
# is not provided. This will be removed in a follow up patch
|
||||
# once CI has been converted to pass in --use-heat=False
|
||||
if parsed_args.use_heat is None or \
|
||||
parsed_args.use_heat.lower() == "false":
|
||||
self.log.warning(_('Non-containerized undercloud deployment is '
|
||||
'deprecated in Rocky cycle.'))
|
||||
subprocess.check_call(['sudo', 'yum', 'update', '-y',
|
||||
|
@ -141,3 +146,14 @@ class UpgradeUndercloud(InstallUndercloud):
|
|||
# https://bugzilla.redhat.com/show_bug.cgi?id=1315467
|
||||
subprocess.check_call(['sudo', 'systemctl', 'restart',
|
||||
'openstack-nova-api'])
|
||||
else:
|
||||
cmd = undercloud_config.\
|
||||
prepare_undercloud_deploy(
|
||||
upgrade=True,
|
||||
yes=parsed_args.yes,
|
||||
no_validations=parsed_args.
|
||||
no_validations,
|
||||
verbose_level=self.app_args.verbose_level,
|
||||
force_stack_update=parsed_args.force_stack_update)
|
||||
self.log.warning("Running: %s" % ' '.join(cmd))
|
||||
subprocess.check_call(cmd)
|
||||
|
|
Loading…
Reference in New Issue