Add ODL deprecation warning in CLI
ODL is deprecated since Rocky. Add a warning
before deployment asking the user if he wants
to continue with deployment even after
deprecation.
The logic is to check for neutron-opendaylight.yaml
environment file passed to overcloud deploy command.
If yes, ask for user confirmation before starting
deployment.
Change-Id: I1b16aab11591fac610cd4bf49a0927f1ec947146
Closes-Bug: #1827366
(cherry picked from commit 1fee54b9be
)
This commit is contained in:
parent
98a8278007
commit
901074e2b5
|
@ -60,3 +60,13 @@ CEPH_UPGRADE_PREPARE_ENV = "environments/lifecycle/ceph-upgrade-prepare.yaml"
|
|||
ENABLE_SSH_ADMIN_TIMEOUT = 300
|
||||
ENABLE_SSH_ADMIN_STATUS_INTERVAL = 5
|
||||
ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 300
|
||||
|
||||
# Key-value pair of deprecated service and its warning message
|
||||
DEPRECATED_SERVICES = {"OS::TripleO::Services::OpenDaylightApi":
|
||||
"You are using OpenDaylight as your networking"
|
||||
" driver for OpenStack. OpenDaylight is deprecated"
|
||||
" starting from Rocky and removed since Stein and "
|
||||
"there is no upgrade or migration path from "
|
||||
"OpenDaylight to another networking backend. We "
|
||||
"recommend you understand other networking "
|
||||
"alternatives such as OVS or OVN. "}
|
||||
|
|
|
@ -31,10 +31,12 @@ import yaml
|
|||
|
||||
from heatclient.common import event_utils
|
||||
from heatclient.exc import HTTPNotFound
|
||||
from osc_lib import exceptions as oscexc
|
||||
from osc_lib.i18n import _
|
||||
from oslo_concurrency import processutils
|
||||
from six.moves import configparser
|
||||
|
||||
from tripleoclient import constants
|
||||
from tripleoclient import exceptions
|
||||
|
||||
|
||||
|
@ -917,3 +919,41 @@ def ffwd_upgrade_operator_confirm(parsed_args_yes, log):
|
|||
log.debug("Fast forward upgrade cancelled on user request")
|
||||
print("Cancelling fast forward upgrade")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def check_file_for_enabled_service(env_file):
|
||||
# This function checks environment file for the said service.
|
||||
# If stack to be deployed/updated/upgraded has any deprecated service
|
||||
# enabled, throw a warning about its deprecation and ask the user
|
||||
# whether to proceed with deployment despite deprecation.
|
||||
# For ODL as an example:
|
||||
# If "OS::TripleO::Services::OpenDaylightApi" service is included
|
||||
# in any of the parsed env_files, then check its value.
|
||||
# OS::TripleO::Services::OpenDaylightApi NOT OS::Heat::None
|
||||
# ODL is enabled.
|
||||
|
||||
log = logging.getLogger(__name__ + ".check_file_for_enabled_service")
|
||||
|
||||
if os.path.exists(env_file):
|
||||
content = yaml.load(open(env_file))
|
||||
deprecated_services_enabled = []
|
||||
for service in constants.DEPRECATED_SERVICES.keys():
|
||||
if ("resource_registry" in content and
|
||||
service in content["resource_registry"]):
|
||||
if content["resource_registry"][service] != "OS::Heat::None":
|
||||
log.warning("service " + service + " is enabled in "
|
||||
+ str(env_file) + ". " +
|
||||
constants.DEPRECATED_SERVICES[service])
|
||||
deprecated_services_enabled.append(service)
|
||||
|
||||
if deprecated_services_enabled:
|
||||
confirm = prompt_user_for_confirmation(
|
||||
message="Do you still wish to continue with deployment [y/N]",
|
||||
logger=log)
|
||||
if not confirm:
|
||||
raise oscexc.CommandError("Action not confirmed, exiting.")
|
||||
|
||||
|
||||
def check_deprecated_service_is_enabled(environment_files):
|
||||
for env_file in environment_files:
|
||||
check_file_for_enabled_service(env_file)
|
||||
|
|
|
@ -920,6 +920,12 @@ class DeployOvercloud(command.Command):
|
|||
|
||||
self._validate_args(parsed_args)
|
||||
|
||||
# Throw warning if deprecated service is enabled and
|
||||
# ask user if deployment should still be continued.
|
||||
if parsed_args.environment_files:
|
||||
utils.check_deprecated_service_is_enabled(
|
||||
parsed_args.environment_files)
|
||||
|
||||
stack = utils.get_stack(self.orchestration_client, parsed_args.stack)
|
||||
|
||||
if stack and stack.stack_status == 'IN_PROGRESS':
|
||||
|
|
|
@ -70,6 +70,12 @@ class UpdatePrepare(DeployOvercloud):
|
|||
parsed_args.environment_files, templates_dir,
|
||||
constants.UPDATE_PREPARE_ENV)
|
||||
|
||||
# Throw deprecation warning if service is enabled and
|
||||
# ask user if update should still be continued.
|
||||
if parsed_args.environment_files:
|
||||
oooutils.check_deprecated_service_is_enabled(
|
||||
parsed_args.environment_files)
|
||||
|
||||
super(UpdatePrepare, self).take_action(parsed_args)
|
||||
package_update.update(clients, container=stack_name,
|
||||
ceph_ansible_playbook=ceph_ansible_playbook)
|
||||
|
|
|
@ -49,6 +49,13 @@ class UpgradePrepare(DeployOvercloud):
|
|||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
# Throw deprecation warning if service is enabled and
|
||||
# ask user if upgrade should still be continued.
|
||||
if parsed_args.environment_files:
|
||||
oooutils.check_deprecated_service_is_enabled(
|
||||
parsed_args.environment_files)
|
||||
|
||||
clients = self.app.client_manager
|
||||
|
||||
stack = oooutils.get_stack(clients.orchestration,
|
||||
|
|
Loading…
Reference in New Issue