Remove ffwd-upgrade commands from tripleoclient.
Now that the FFU process relies on the openstack overcloud upgrade commands there is no need to keep the old ffwd-upgrade command available. This patch removes the three ffwd-upgrade (run, prepare and converge) as well as their tests, utils functions and constants. Change-Id: If0c0ed9a44a51cf367fd060c77e10055f367694c (cherry picked from commit8e7331098e
) (cherry picked from commit5cf5617280
)
This commit is contained in:
parent
037dd3342f
commit
6c8086ff69
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
deprecations:
|
||||
- |
|
||||
The ffwd-upgrade command isn't needed anymore since Queens. The ffwd upgrade
|
||||
now relies on the overcloud upgrade commands, therefore there is no need to
|
||||
keep the old ffwd-upgrade commands around as they could just cause confusion
|
||||
to the user.
|
|
@ -101,9 +101,6 @@ openstack.tripleoclient.v1 =
|
|||
overcloud_upgrade_converge = tripleoclient.v1.overcloud_upgrade:UpgradeConvergeOvercloud
|
||||
overcloud_external-update_run = tripleoclient.v1.overcloud_external_update:ExternalUpdateRun
|
||||
overcloud_external-upgrade_run = tripleoclient.v1.overcloud_external_upgrade:ExternalUpgradeRun
|
||||
overcloud_ffwd-upgrade_prepare = tripleoclient.v1.overcloud_ffwd_upgrade:FFWDUpgradePrepare
|
||||
overcloud_ffwd-upgrade_run = tripleoclient.v1.overcloud_ffwd_upgrade:FFWDUpgradeRun
|
||||
overcloud_ffwd-upgrade_converge = tripleoclient.v1.overcloud_ffwd_upgrade:FFWDUpgradeConverge
|
||||
overcloud_execute = tripleoclient.v1.overcloud_execute:RemoteExecute
|
||||
overcloud_generate_fencing = tripleoclient.v1.overcloud_parameters:GenerateFencingParameters
|
||||
tripleo_container_image_delete = tripleoclient.v1.container_image:TripleOContainerImageDelete
|
||||
|
|
|
@ -61,8 +61,6 @@ STACK_TIMEOUT = 240
|
|||
IRONIC_HTTP_BOOT_BIND_MOUNT = '/var/lib/ironic/httpboot'
|
||||
IRONIC_LOCAL_IMAGE_PATH = '/var/lib/ironic/images'
|
||||
|
||||
# The default ffwd upgrade ansible playbooks generated from heat stack output
|
||||
FFWD_UPGRADE_PLAYBOOK = "fast_forward_upgrade_playbook.yaml"
|
||||
# The default minor update ansible playbooks generated from heat stack output
|
||||
MINOR_UPDATE_PLAYBOOKS = ['update_steps_playbook.yaml']
|
||||
# The default major upgrade ansible playbooks generated from heat stack output
|
||||
|
@ -86,11 +84,6 @@ UPGRADE_CONVERGE_FORBIDDEN_PARAMS = ["ceph3_namespace",
|
|||
"namespace_stein",
|
||||
"tag_stein",
|
||||
]
|
||||
FFWD_UPGRADE_PREPARE_ENV = "environments/lifecycle/ffwd-upgrade-prepare.yaml"
|
||||
FFWD_UPGRADE_CONVERGE_ENV = "environments/lifecycle/ffwd-upgrade-converge.yaml"
|
||||
FFWD_UPGRADE_PREPARE_SCRIPT = ("#!/bin/bash \n"
|
||||
"rm -f /usr/libexec/os-apply-config/templates/"
|
||||
"etc/os-net-config/config.json || true \n")
|
||||
|
||||
ENABLE_SSH_ADMIN_TIMEOUT = 600
|
||||
ENABLE_SSH_ADMIN_STATUS_INTERVAL = 5
|
||||
|
@ -185,7 +178,7 @@ EXPORT_PASSWORD_EXCLUDE_PATTERNS = [
|
|||
]
|
||||
|
||||
# Package that need to be to the latest before undercloud
|
||||
# update/update/ffwd.
|
||||
# update/update
|
||||
UNDERCLOUD_EXTRA_PACKAGES = [
|
||||
"openstack-tripleo-common",
|
||||
"openstack-tripleo-heat-templates",
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
# Copyright 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from osc_lib.tests import utils
|
||||
|
||||
from tripleoclient.tests import fakes
|
||||
|
||||
|
||||
class FakeClientWrapper(object):
|
||||
|
||||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self.object_store = FakeObjectClient()
|
||||
|
||||
def messaging_websocket(self, queue="tripleo"):
|
||||
return fakes.FakeWebSocket()
|
||||
|
||||
|
||||
class FakeObjectClient(object):
|
||||
|
||||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self.put_object = mock.Mock()
|
||||
|
||||
def get_object(self, *args):
|
||||
return
|
||||
|
||||
|
||||
class TestFFWDUpgradePrepare(utils.TestCommand):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradePrepare, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
self.app.client_manager.workflow_engine = workflow
|
||||
get_key = mock.patch('tripleoclient.utils.get_key')
|
||||
get_key.start()
|
||||
get_key.return_value = 'keyfile-path'
|
||||
self.addCleanup(get_key.stop)
|
||||
|
||||
|
||||
class TestFFWDUpgradeRun(utils.TestCommand):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradeRun, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.workflow_engine = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
|
||||
|
||||
class TestFFWDUpgradeConverge(utils.TestCommand):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradeConverge, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
self.app.client_manager.workflow_engine = workflow
|
|
@ -1,263 +0,0 @@
|
|||
# Copyright 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
|
||||
from osc_lib.tests.utils import ParserException
|
||||
from tripleoclient import constants
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.tests.v1.overcloud_ffwd_upgrade import fakes
|
||||
from tripleoclient.v1 import overcloud_ffwd_upgrade
|
||||
|
||||
|
||||
class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradePrepare, self).setUp()
|
||||
|
||||
# Get the command object to test
|
||||
app_args = mock.Mock()
|
||||
app_args.verbose_level = 1
|
||||
self.cmd = overcloud_ffwd_upgrade.FFWDUpgradePrepare(self.app,
|
||||
app_args)
|
||||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||
self.mock_uuid4 = uuid4_patcher.start()
|
||||
self.addCleanup(self.mock_uuid4.stop)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'take_action')
|
||||
@mock.patch('tripleoclient.workflows.deployment.'
|
||||
'get_hosts_and_enable_ssh_admin', autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.deployment.create_overcloudrc',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.write_overcloudrc', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_stack',
|
||||
autospec=True)
|
||||
@mock.patch(
|
||||
'tripleoclient.v1.overcloud_ffwd_upgrade.FFWDUpgradePrepare.log',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.package_update.update',
|
||||
autospec=True)
|
||||
@mock.patch('os.path.abspath')
|
||||
@mock.patch('yaml.load')
|
||||
@mock.patch('shutil.copytree', autospec=True)
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
def test_ffwd_upgrade(self,
|
||||
mock_deploy,
|
||||
mock_open,
|
||||
mock_copy,
|
||||
mock_yaml,
|
||||
mock_abspath,
|
||||
mock_ffwd_upgrade,
|
||||
mock_logger,
|
||||
mock_get_stack,
|
||||
mock_prepend_env,
|
||||
mock_write_overcloudrc,
|
||||
mock_overcloudrc,
|
||||
mock_enable_ssh_admin,
|
||||
mock_overcloud_deploy):
|
||||
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack.stack_name = 'mystack'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
|
||||
argslist = ['--stack', 'mystack', '--templates',
|
||||
'--yes']
|
||||
verifylist = [
|
||||
('stack', 'mystack'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('yes', True),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_ffwd_upgrade.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='mystack',
|
||||
)
|
||||
|
||||
mock_overcloudrc.assert_called_once_with(mock.ANY,
|
||||
container="mystack")
|
||||
mock_write_overcloudrc.assert_called_once_with("mystack",
|
||||
mock.ANY)
|
||||
mock_enable_ssh_admin.assert_called_once_with(
|
||||
self.cmd.log, self.app.client_manager, mock_stack,
|
||||
parsed_args.overcloud_ssh_network,
|
||||
parsed_args.overcloud_ssh_user, mock.ANY,
|
||||
600, 600)
|
||||
mock_overcloud_deploy.assert_called_once_with(parsed_args)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'take_action')
|
||||
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.package_update.update',
|
||||
autospec=True)
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@mock.patch('os.path.abspath')
|
||||
@mock.patch('yaml.load')
|
||||
@mock.patch('shutil.copytree', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
def test_ffwd_upgrade_failed(
|
||||
self, mock_deploy, mock_copy, mock_yaml, mock_abspath, mock_open,
|
||||
mock_ffwd_upgrade, mock_prepend_env, mock_overcloud_deploy):
|
||||
mock_ffwd_upgrade.side_effect = exceptions.DeploymentError()
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--yes', ]
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('yes', True),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
||||
self.assertRaises(exceptions.DeploymentError,
|
||||
self.cmd.take_action, parsed_args)
|
||||
mock_overcloud_deploy.assert_called_once_with(parsed_args)
|
||||
|
||||
|
||||
class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradeRun, self).setUp()
|
||||
|
||||
# Get the command object to test
|
||||
app_args = mock.Mock()
|
||||
app_args.verbose_level = 1
|
||||
self.cmd = overcloud_ffwd_upgrade.FFWDUpgradeRun(self.app, app_args)
|
||||
|
||||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||
self.mock_uuid4 = uuid4_patcher.start()
|
||||
self.addCleanup(self.mock_uuid4.stop)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
|
||||
autospec=True)
|
||||
@mock.patch('os.path.expanduser')
|
||||
@mock.patch('oslo_concurrency.processutils.execute')
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
def test_ffwd_upgrade_playbook(
|
||||
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible):
|
||||
mock_expanduser.return_value = '/home/fake/'
|
||||
argslist = ['--ssh-user', 'heat-admin', '--yes']
|
||||
verifylist = [('ssh_user', 'heat-admin'), ('yes', True), ]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
with mock.patch('os.path.exists') as mock_exists:
|
||||
mock_exists.return_value = True
|
||||
self.cmd.take_action(parsed_args)
|
||||
upgrade_ansible.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='overcloud',
|
||||
inventory_file=mock_open().__enter__().read(),
|
||||
nodes=None,
|
||||
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
|
||||
node_user='heat-admin',
|
||||
tags=None,
|
||||
skip_tags=None,
|
||||
verbosity=1,
|
||||
extra_vars=None
|
||||
)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
|
||||
autospec=True)
|
||||
@mock.patch('os.path.expanduser')
|
||||
@mock.patch('oslo_concurrency.processutils.execute')
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
def test_ffwd_upgrade_playbook_non_default_user(
|
||||
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible):
|
||||
mock_expanduser.return_value = '/home/fake/'
|
||||
argslist = ['--ssh-user', 'my-user', '--yes']
|
||||
verifylist = [('ssh_user', 'my-user'), ('yes', True), ]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
with mock.patch('os.path.exists') as mock_exists:
|
||||
mock_exists.return_value = True
|
||||
self.cmd.take_action(parsed_args)
|
||||
upgrade_ansible.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='overcloud',
|
||||
inventory_file=mock_open().__enter__().read(),
|
||||
nodes=None,
|
||||
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
|
||||
node_user='my-user',
|
||||
tags=None,
|
||||
skip_tags=None,
|
||||
verbosity=1,
|
||||
extra_vars=None
|
||||
)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
|
||||
autospec=True)
|
||||
@mock.patch('os.path.expanduser')
|
||||
@mock.patch('oslo_concurrency.processutils.execute')
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
def test_upgrade_no_nodes_or_roles(self, mock_open, mock_execute,
|
||||
mock_expanduser, upgrade_ansible):
|
||||
mock_expanduser.return_value = '/home/fake/'
|
||||
argslist = ["--limit", "controller-1", "--roles", "foo", "--yes"]
|
||||
verifylist = []
|
||||
self.assertRaises(ParserException, lambda: self.check_parser(
|
||||
self.cmd, argslist, verifylist))
|
||||
|
||||
@mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||
autospec=True)
|
||||
@mock.patch('os.path.expanduser')
|
||||
@mock.patch('oslo_concurrency.processutils.execute')
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
def test_upgrade_limit(self, mock_open, mock_execute,
|
||||
mock_expanduser, upgrade_ansible):
|
||||
mock_expanduser.return_value = '/home/fake/'
|
||||
argslist = ['--limit', 'controller1,controller2,controll3']
|
||||
verifylist = [('limit', 'controller1,controller2,controll3')]
|
||||
self.assertRaises(ParserException, lambda: self.check_parser(
|
||||
self.cmd, argslist, verifylist))
|
||||
|
||||
|
||||
class TestFFWDUpgradeConverge(fakes.TestFFWDUpgradeConverge):
|
||||
|
||||
def setUp(self):
|
||||
super(TestFFWDUpgradeConverge, self).setUp()
|
||||
|
||||
# Get the command object to test
|
||||
app_args = mock.Mock()
|
||||
app_args.verbose_level = 1
|
||||
self.cmd = overcloud_ffwd_upgrade.FFWDUpgradeConverge(self.app,
|
||||
app_args)
|
||||
|
||||
@mock.patch(
|
||||
'tripleoclient.v1.overcloud_deploy.DeployOvercloud.take_action')
|
||||
def test_ffwd_upgrade_converge(self, deploy_action):
|
||||
argslist = ['--stack', 'le_overcloud', '--templates', '--yes']
|
||||
verifylist = [
|
||||
('stack', 'le_overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('yes', True)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
||||
with mock.patch('os.path.exists') as mock_exists, \
|
||||
mock.patch('os.path.isfile') as mock_isfile:
|
||||
mock_exists.return_value = True
|
||||
mock_isfile.return_value = True
|
||||
self.cmd.take_action(parsed_args)
|
||||
assert('/usr/share/openstack-tripleo-heat-templates/'
|
||||
'environments/lifecycle/ffwd-upgrade-converge.yaml'
|
||||
in parsed_args.environment_files)
|
||||
deploy_action.assert_called_once_with(parsed_args)
|
|
@ -1455,32 +1455,6 @@ def run_command_and_log(log, cmd, cwd=None, env=None, retcode_only=True):
|
|||
return proc
|
||||
|
||||
|
||||
def ffwd_upgrade_operator_confirm(parsed_args_yes, log):
|
||||
print("\nWarning! The TripleO Fast Forward Upgrade "
|
||||
"workflow is a critical operation against the deployed "
|
||||
"environment.\nOnce and if you decide to use ffwd-upgrade "
|
||||
"in production, ensure you are adequately prepared "
|
||||
"with valid backup of your current deployment state.\n")
|
||||
if parsed_args_yes:
|
||||
log.debug(_("Fast forward upgrade --yes continuing"))
|
||||
print(_("Continuing fast forward upgrade"))
|
||||
return
|
||||
else:
|
||||
# Fix Python 2.x.
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
response = input("Proceed with the fast forward upgrade? "
|
||||
"Type 'yes' to continue and anything else to "
|
||||
"cancel.\nConsider using the --yes parameter if "
|
||||
"you wish to skip this warning in future. ")
|
||||
if response != 'yes':
|
||||
log.debug(_("Fast forward upgrade cancelled on user request"))
|
||||
print(_("Cancelling fast forward upgrade"))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def build_prepare_env(environment_files, environment_directories):
|
||||
'''Build the environment for container image prepare
|
||||
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
# Copyright 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from osc_lib.i18n import _
|
||||
from osc_lib import utils
|
||||
|
||||
from tripleoclient import command
|
||||
from tripleoclient import constants
|
||||
from tripleoclient import utils as oooutils
|
||||
from tripleoclient.v1.overcloud_deploy import DeployOvercloud
|
||||
from tripleoclient.workflows import deployment
|
||||
from tripleoclient.workflows import package_update
|
||||
|
||||
CONF = cfg.CONF
|
||||
logging.register_options(CONF)
|
||||
logging.setup(CONF, '')
|
||||
|
||||
|
||||
class FFWDUpgradePrepare(DeployOvercloud):
|
||||
"""Run heat stack update for overcloud nodes to refresh heat stack outputs.
|
||||
|
||||
The heat stack outputs are what we use later on to generate ansible
|
||||
playbooks which deliver the ffwd upgrade workflow. This is used as the
|
||||
first step for a fast forward upgrade of your overcloud.
|
||||
"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".FFWDUpgradePrepare")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(FFWDUpgradePrepare, self).get_parser(prog_name)
|
||||
parser.add_argument('--yes',
|
||||
action='store_true',
|
||||
help=_("Use --yes to skip the confirmation "
|
||||
"required before any ffwd-upgrade "
|
||||
"operation. Use this with caution! "),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log)
|
||||
|
||||
clients = self.app.client_manager
|
||||
|
||||
stack = oooutils.get_stack(clients.orchestration,
|
||||
parsed_args.stack)
|
||||
|
||||
stack_name = stack.stack_name
|
||||
|
||||
# ffwd-upgrade "init" run command on overcloud nodes
|
||||
package_update.run_on_nodes(
|
||||
clients, server_name='all',
|
||||
config_name='ffwd-upgrade-prepare',
|
||||
config=constants.FFWD_UPGRADE_PREPARE_SCRIPT, group='script')
|
||||
|
||||
# In case of update and upgrade we need to force the
|
||||
# update_plan_only. The heat stack update is done by the
|
||||
# packag_update mistral action
|
||||
parsed_args.update_plan_only = True
|
||||
|
||||
# Add the prepare environment into the args to unset noop etc
|
||||
templates_dir = (parsed_args.templates or
|
||||
constants.TRIPLEO_HEAT_TEMPLATES)
|
||||
if not parsed_args.environment_files:
|
||||
parsed_args.environment_files = []
|
||||
parsed_args.environment_files = oooutils.prepend_environment(
|
||||
parsed_args.environment_files, templates_dir,
|
||||
constants.FFWD_UPGRADE_PREPARE_ENV)
|
||||
|
||||
super(FFWDUpgradePrepare, self).take_action(parsed_args)
|
||||
package_update.update(clients, container=stack_name)
|
||||
package_update.get_config(clients, container=stack_name)
|
||||
|
||||
overcloudrcs = deployment.create_overcloudrc(
|
||||
clients, container=stack_name)
|
||||
oooutils.write_overcloudrc(stack_name, overcloudrcs)
|
||||
|
||||
# refresh stack info and enable ssh admin for Ansible-via-Mistral
|
||||
stack = oooutils.get_stack(clients.orchestration, parsed_args.stack)
|
||||
deployment.get_hosts_and_enable_ssh_admin(
|
||||
self.log, clients, stack, parsed_args.overcloud_ssh_network,
|
||||
parsed_args.overcloud_ssh_user, self.get_key_pair(parsed_args),
|
||||
parsed_args.overcloud_ssh_enable_timeout,
|
||||
parsed_args.overcloud_ssh_port_timeout)
|
||||
|
||||
self.log.info("FFWD Upgrade Prepare on stack {0} complete.".format(
|
||||
parsed_args.stack))
|
||||
|
||||
|
||||
class FFWDUpgradeRun(command.Command):
|
||||
"""Run fast forward upgrade ansible playbooks on Overcloud nodes
|
||||
|
||||
This will run the fast_forward_upgrade_playbook.yaml ansible playbook.
|
||||
This playbook was generated when you ran the 'ffwd-upgrade prepare'
|
||||
command. Running 'ffwd-upgrade run ' is the second step in the ffwd
|
||||
upgrade workflow.
|
||||
"""
|
||||
log = logging.getLogger(__name__ + ".FFWDUpgradeRun")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(FFWDUpgradeRun, self).get_parser(prog_name)
|
||||
parser.add_argument('--yes',
|
||||
action='store_true',
|
||||
help=_("Use --yes to skip the confirmation "
|
||||
"required before any ffwd-upgrade "
|
||||
"operation. Use this with caution! "),
|
||||
)
|
||||
parser.add_argument('--static-inventory',
|
||||
dest='static_inventory',
|
||||
action="store",
|
||||
default=None,
|
||||
help=_('Path to an existing ansible inventory to '
|
||||
'use. If not specified, one will be '
|
||||
'generated in '
|
||||
'~/tripleo-ansible-inventory.yaml')
|
||||
)
|
||||
parser.add_argument("--ssh-user",
|
||||
dest="ssh_user",
|
||||
action="store",
|
||||
default="tripleo-admin",
|
||||
help=_("DEPRECATED: Only tripleo-admin should be "
|
||||
"used as ssh user.")
|
||||
)
|
||||
parser.add_argument('--stack', dest='stack',
|
||||
help=_('Name or ID of heat stack '
|
||||
'(default=Env: OVERCLOUD_STACK_NAME)'),
|
||||
default=utils.env('OVERCLOUD_STACK_NAME',
|
||||
default='overcloud')
|
||||
)
|
||||
parser.add_argument('--no-workflow', dest='no_workflow',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Run ansible-playbook directly via '
|
||||
'system command instead of running Ansible'
|
||||
'via the TripleO mistral workflows.')
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log)
|
||||
verbosity = self.app_args.verbose_level
|
||||
clients = self.app.client_manager
|
||||
orchestration = clients.orchestration
|
||||
stack = parsed_args.stack
|
||||
|
||||
ansible_dir = None
|
||||
key = None
|
||||
# Disable mistral
|
||||
if parsed_args.no_workflow:
|
||||
ansible_dir = oooutils.download_ansible_playbooks(orchestration,
|
||||
stack)
|
||||
key = package_update.get_key(clients)
|
||||
|
||||
# Run ansible:
|
||||
inventory = oooutils.get_tripleo_ansible_inventory(
|
||||
inventory_file=parsed_args.static_inventory,
|
||||
ssh_user=parsed_args.ssh_user, stack=parsed_args.stack)
|
||||
# Don't expost limit_hosts. We need this on the whole overcloud.
|
||||
limit_hosts = None
|
||||
oooutils.run_update_ansible_action(
|
||||
self.log, clients, parsed_args.stack, limit_hosts, inventory,
|
||||
constants.FFWD_UPGRADE_PLAYBOOK, [], parsed_args.ssh_user,
|
||||
(None if parsed_args.no_workflow else package_update),
|
||||
verbosity=verbosity, workdir=ansible_dir, priv_key=key)
|
||||
|
||||
|
||||
class FFWDUpgradeConverge(DeployOvercloud):
|
||||
"""Converge the fast-forward upgrade on Overcloud Nodes
|
||||
|
||||
This is the last step for completion of a fast forward upgrade.
|
||||
The main task is updating the plan and stack to unblock future
|
||||
stack updates. For the ffwd upgrade workflow we have set and
|
||||
used the config-download Software/Structured Deployment for the
|
||||
OS::TripleO and OS::Heat resources. This unsets those back to
|
||||
their default values.
|
||||
"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".FFWDUpgradeConverge")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(FFWDUpgradeConverge, self).get_parser(prog_name)
|
||||
parser.add_argument('--yes',
|
||||
action='store_true',
|
||||
help=_("Use --yes to skip the confirmation "
|
||||
"required before any ffwd-upgrade "
|
||||
"operation. Use this with caution! "),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log)
|
||||
|
||||
# Add the converge environment into the args to unset noop etc
|
||||
templates_dir = (parsed_args.templates or
|
||||
constants.TRIPLEO_HEAT_TEMPLATES)
|
||||
if not parsed_args.environment_files:
|
||||
parsed_args.environment_files = []
|
||||
parsed_args.environment_files = oooutils.prepend_environment(
|
||||
parsed_args.environment_files, templates_dir,
|
||||
constants.FFWD_UPGRADE_CONVERGE_ENV)
|
||||
|
||||
super(FFWDUpgradeConverge, self).take_action(parsed_args)
|
||||
self.log.info("FFWD Upgrade Converge on stack {0} complete.".format(
|
||||
parsed_args.stack))
|
Loading…
Reference in New Issue