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
ba03c5e11a
commit
ef8d2a1632
|
@ -102,3 +102,13 @@ DEPLOY_ANSIBLE_ACTIONS = {
|
|||
'online-upgrade': 'external_upgrade_steps_playbook.yaml '
|
||||
'--tags online_upgrade',
|
||||
}
|
||||
|
||||
# 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. "}
|
||||
|
|
|
@ -37,6 +37,7 @@ from heatclient.common import event_utils
|
|||
from heatclient.common import template_utils
|
||||
from heatclient.common import utils as heat_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
|
||||
|
@ -1487,3 +1488,39 @@ def check_env_for_proxy(no_proxy_hosts=None):
|
|||
'addresses "{}" may be missing from the no_proxy '
|
||||
'environment variable').format(','.join(missing_hosts))
|
||||
raise RuntimeError(message)
|
||||
|
||||
|
||||
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.
|
||||
|
||||
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.warn("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)
|
||||
|
|
|
@ -852,6 +852,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':
|
||||
|
|
|
@ -64,6 +64,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)
|
||||
package_update.get_config(clients, container=stack_name)
|
||||
|
|
|
@ -47,6 +47,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