Merge "Add ODL deprecation warning in CLI"
This commit is contained in:
commit
875bbc74ee
@ -108,3 +108,13 @@ DEPLOY_ANSIBLE_ACTIONS = {
|
|||||||
'online-upgrade': 'external_upgrade_steps_playbook.yaml '
|
'online-upgrade': 'external_upgrade_steps_playbook.yaml '
|
||||||
'--tags online_upgrade',
|
'--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. "}
|
||||||
|
@ -41,6 +41,7 @@ from heatclient.common import event_utils
|
|||||||
from heatclient.common import template_utils
|
from heatclient.common import template_utils
|
||||||
from heatclient.common import utils as heat_utils
|
from heatclient.common import utils as heat_utils
|
||||||
from heatclient.exc import HTTPNotFound
|
from heatclient.exc import HTTPNotFound
|
||||||
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from six.moves import configparser
|
from six.moves import configparser
|
||||||
@ -1734,3 +1735,39 @@ def ansible_symlink():
|
|||||||
cmd.extend(['/usr/bin/ansible-playbook',
|
cmd.extend(['/usr/bin/ansible-playbook',
|
||||||
'/usr/bin/' + ansible_playbook_cmd])
|
'/usr/bin/' + ansible_playbook_cmd])
|
||||||
run_command(cmd, name='ansible-playbook-3-symlink')
|
run_command(cmd, name='ansible-playbook-3-symlink')
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
@ -883,6 +883,12 @@ class DeployOvercloud(command.Command):
|
|||||||
|
|
||||||
self._validate_args(parsed_args)
|
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)
|
stack = utils.get_stack(self.orchestration_client, parsed_args.stack)
|
||||||
|
|
||||||
if stack and stack.stack_status == 'IN_PROGRESS':
|
if stack and stack.stack_status == 'IN_PROGRESS':
|
||||||
|
@ -64,6 +64,12 @@ class UpdatePrepare(DeployOvercloud):
|
|||||||
parsed_args.environment_files, templates_dir,
|
parsed_args.environment_files, templates_dir,
|
||||||
constants.UPDATE_PREPARE_ENV)
|
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)
|
super(UpdatePrepare, self).take_action(parsed_args)
|
||||||
package_update.update(clients, container=stack_name)
|
package_update.update(clients, container=stack_name)
|
||||||
package_update.get_config(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):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug("take_action(%s)" % 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
|
clients = self.app.client_manager
|
||||||
|
|
||||||
stack = oooutils.get_stack(clients.orchestration,
|
stack = oooutils.get_stack(clients.orchestration,
|
||||||
|
Loading…
Reference in New Issue
Block a user