5d1450a774
This had no effect as we only updated the plan and not the
stack. We'll do a normal converge after Ceph upgrade command, which
will also take care of putting back the normal deploy
CephAnsiblePlaybook.
Furthermore it was prepending the converge env file to a list of envs
which already had the *prepare* env file at a latter position (we
reused the env list from the prepare call :) ), so it kept doing
prepare operation instead of converge.
And perhaps most importantly, the messages printed to user are
misleading since no converge was really happening.
Also adds support for --container-registry-file to ceph-upgrade command,
while not necessary, some of the functions called by ceph-upgrade
command expect to receive the container-registry parameters.
Co-Authored-By: Giulio Fidente <gfidente@redhat.com>
Change-Id: I025eac40f8bda5f23c789e7fef1a9e9b49947f66
Partial-Bug: #1768586
(cherry picked from commit 1612b374d7
)
81 lines
3.3 KiB
Python
81 lines
3.3 KiB
Python
# Copyright 2015 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 logging
|
|
|
|
from osc_lib.i18n import _
|
|
|
|
from tripleoclient import constants
|
|
from tripleoclient import utils as oooutils
|
|
from tripleoclient.v1.overcloud_deploy import DeployOvercloud
|
|
from tripleoclient.workflows import package_update
|
|
|
|
|
|
class CephUpgrade(DeployOvercloud):
|
|
"""Run heat stack update for overcloud nodes to run Ceph upgrade."""
|
|
|
|
log = logging.getLogger(__name__ + ".CephUpgrade")
|
|
|
|
def get_parser(self, prog_name):
|
|
parser = super(CephUpgrade, self).get_parser(prog_name)
|
|
parser.add_argument('--container-registry-file',
|
|
dest='container_registry_file',
|
|
default=None,
|
|
help=_("Optional path to file with container "
|
|
"registry data for the update"),
|
|
)
|
|
parser.add_argument('--ceph-ansible-playbook',
|
|
action="store",
|
|
default="/usr/share/ceph-ansible"
|
|
"/infrastructure-playbooks"
|
|
"/rolling_update.yml",
|
|
help=_('Path to switch the ceph-ansible playbook '
|
|
'used for update. '))
|
|
return parser
|
|
|
|
def take_action(self, parsed_args):
|
|
self.log.debug("take_action(%s)" % parsed_args)
|
|
clients = self.app.client_manager
|
|
|
|
stack = oooutils.get_stack(clients.orchestration,
|
|
parsed_args.stack)
|
|
|
|
stack_name = stack.stack_name
|
|
registry = oooutils.load_container_registry(
|
|
self.log, parsed_args.container_registry_file)
|
|
|
|
# Run update
|
|
ceph_ansible_playbook = parsed_args.ceph_ansible_playbook
|
|
# Run Overcloud deploy (stack update)
|
|
# In case of update and upgrade we need to force the
|
|
# update_plan_only. The heat stack update is done by the
|
|
# package_update mistral action
|
|
parsed_args.update_plan_only = True
|
|
|
|
# Add the upgrade-prepare.yaml environment to set noops etc
|
|
templates_dir = (parsed_args.templates or
|
|
constants.TRIPLEO_HEAT_TEMPLATES)
|
|
parsed_args.environment_files = oooutils.prepend_environment(
|
|
parsed_args.environment_files, templates_dir,
|
|
constants.CEPH_UPGRADE_PREPARE_ENV)
|
|
|
|
super(CephUpgrade, self).take_action(parsed_args)
|
|
package_update.update(clients, container=stack_name,
|
|
container_registry=registry,
|
|
ceph_ansible_playbook=ceph_ansible_playbook)
|
|
package_update.get_config(clients, container=stack_name)
|
|
print("Ceph Upgrade on stack {0} complete.".format(
|
|
parsed_args.stack))
|