diff --git a/nfv/nfv-client/nfv_client/shell.py b/nfv/nfv-client/nfv_client/shell.py index b00e96c4..08cd04bb 100755 --- a/nfv/nfv-client/nfv_client/shell.py +++ b/nfv/nfv-client/nfv_client/shell.py @@ -428,7 +428,8 @@ def setup_sw_deploy_parser(commands): [sw_update.INSTANCE_ACTION_STOP_START, # instance actions sw_update.INSTANCE_ACTION_MIGRATE], [sw_update.ALARM_RESTRICTIONS_STRICT, # alarm restrictions - sw_update.ALARM_RESTRICTIONS_RELAXED], + sw_update.ALARM_RESTRICTIONS_RELAXED, + sw_update.ALARM_RESTRICTIONS_PERMISSIVE], min_parallel=2, max_parallel=10 # SW Deploy supports 2..10 workers in parallel ) diff --git a/nfv/nfv-client/nfv_client/sw_update/__init__.py b/nfv/nfv-client/nfv_client/sw_update/__init__.py index da6532de..55c1d879 100755 --- a/nfv/nfv-client/nfv_client/sw_update/__init__.py +++ b/nfv/nfv-client/nfv_client/sw_update/__init__.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # from nfv_client.sw_update._sw_update import abort_strategy # noqa: F401 +from nfv_client.sw_update._sw_update import ALARM_RESTRICTIONS_PERMISSIVE # noqa: F401 from nfv_client.sw_update._sw_update import ALARM_RESTRICTIONS_RELAXED # noqa: F401 from nfv_client.sw_update._sw_update import ALARM_RESTRICTIONS_STRICT # noqa: F401 from nfv_client.sw_update._sw_update import apply_strategy # noqa: F401 diff --git a/nfv/nfv-client/nfv_client/sw_update/_sw_update.py b/nfv/nfv-client/nfv_client/sw_update/_sw_update.py index 1ab00a47..f5a5abb3 100755 --- a/nfv/nfv-client/nfv_client/sw_update/_sw_update.py +++ b/nfv/nfv-client/nfv_client/sw_update/_sw_update.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +import sys + from nfv_client.openstack import openstack from nfv_client.openstack import sw_update import textwrap @@ -28,6 +30,7 @@ INSTANCE_ACTION_STOP_START = 'stop-start' ALARM_RESTRICTIONS_STRICT = 'strict' ALARM_RESTRICTIONS_RELAXED = 'relaxed' +ALARM_RESTRICTIONS_PERMISSIVE = 'permissive' def _print(indent_by, field, value, remains=''): @@ -223,6 +226,16 @@ def create_strategy(os_auth_uri, os_project_name, os_project_domain_name, """ Software Update - Create Strategy """ + + if alarm_restrictions == ALARM_RESTRICTIONS_PERMISSIVE: + response = input( + "Using --alarm-restrictions permissive is unsafe.\n" + "Ensure you have contacted support and understand the possible complications.\n" + "Enter 'yes' to continue or anything else to abort: " + ) + if response != "yes": + sys.exit(1) + token = openstack.get_token(os_auth_uri, os_project_name, os_project_domain_name, os_username, os_password, os_user_domain_name) diff --git a/nfv/nfv-client/scripts/sw-manager.completion b/nfv/nfv-client/scripts/sw-manager.completion index 311187c1..6d25d841 100755 --- a/nfv/nfv-client/scripts/sw-manager.completion +++ b/nfv/nfv-client/scripts/sw-manager.completion @@ -77,7 +77,7 @@ function _swmanager() return 0 ;; --alarm-restrictions) - COMPREPLY=($(compgen -W "strict relaxed" -- ${cur})) + COMPREPLY=($(compgen -W "strict relaxed permissive" -- ${cur})) return 0 ;; *) diff --git a/nfv/nfv-common/nfv_common/strategy/_strategy_defs.py b/nfv/nfv-common/nfv_common/strategy/_strategy_defs.py index cf58fcf5..d3e86e77 100755 --- a/nfv/nfv-common/nfv_common/strategy/_strategy_defs.py +++ b/nfv/nfv-common/nfv_common/strategy/_strategy_defs.py @@ -27,6 +27,7 @@ class StrategyAlarmRestrictionTypes(Constants): """ STRICT = Constant('strict') RELAXED = Constant('relaxed') + PERMISSIVE = Constant('permissive') @six.add_metaclass(Singleton) diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py index 820dcabc..5fdb3c3f 100755 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py +++ b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py @@ -61,6 +61,7 @@ class SwUpdateAlarmRestrictionTypes(Constants): """ STRICT = Constant('strict') RELAXED = Constant('relaxed') + PERMISSIVE = Constant('permissive') # Constant Instantiation @@ -93,4 +94,5 @@ SwUpdateInstanceActionTypes = wsme_types.Enum(str, SW_UPDATE_INSTANCE_ACTION.STOP_START) SwUpdateAlarmRestrictionTypes = wsme_types.Enum( str, SW_UPDATE_ALARM_RESTRICTION_TYPES.STRICT, - SW_UPDATE_ALARM_RESTRICTION_TYPES.RELAXED) + SW_UPDATE_ALARM_RESTRICTION_TYPES.RELAXED, + SW_UPDATE_ALARM_RESTRICTION_TYPES.PERMISSIVE) diff --git a/nfv/nfv-vim/nfv_vim/events/_vim_sw_update_api_events.py b/nfv/nfv-vim/nfv_vim/events/_vim_sw_update_api_events.py index 6df3a546..ec4b9ef2 100755 --- a/nfv/nfv-vim/nfv_vim/events/_vim_sw_update_api_events.py +++ b/nfv/nfv-vim/nfv_vim/events/_vim_sw_update_api_events.py @@ -88,6 +88,8 @@ def vim_sw_update_api_create_strategy(connection, msg): if 'strict' == msg.alarm_restrictions: alarm_restrictions = objects.SW_UPDATE_ALARM_RESTRICTION.STRICT + elif 'permissive' == msg.alarm_restrictions: + alarm_restrictions = objects.SW_UPDATE_ALARM_RESTRICTION.PERMISSIVE else: alarm_restrictions = objects.SW_UPDATE_ALARM_RESTRICTION.RELAXED diff --git a/nfv/nfv-vim/nfv_vim/objects/_sw_update.py b/nfv/nfv-vim/nfv_vim/objects/_sw_update.py index 378d977e..7346c643 100755 --- a/nfv/nfv-vim/nfv_vim/objects/_sw_update.py +++ b/nfv/nfv-vim/nfv_vim/objects/_sw_update.py @@ -62,6 +62,7 @@ class SwUpdateAlarmRestrictionTypes(Constants): """ STRICT = Constant('strict') RELAXED = Constant('relaxed') + PERMISSIVE = Constant('permissive') @six.add_metaclass(Singleton) diff --git a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py index 70f394a4..213e6a33 100755 --- a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py +++ b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py @@ -967,7 +967,10 @@ class SwDeployPrecheckStep(strategy.StrategyStep): return strategy.STRATEGY_STEP_RESULT.SUCCESS, reason else: force = ( - self.strategy._alarm_restrictions == strategy.STRATEGY_ALARM_RESTRICTION_TYPES.RELAXED + self.strategy._alarm_restrictions in [ + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.RELAXED, + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.PERMISSIVE, + ] ) nfvi.nfvi_sw_deploy_precheck(self._release, force, self._sw_deploy_precheck_callback()) return strategy.STRATEGY_STEP_RESULT.WAIT, "" @@ -1267,7 +1270,10 @@ class UpgradeStartStep(strategy.StrategyStep): result = strategy.STRATEGY_STEP_RESULT.SUCCESS else: force = ( - self.strategy._alarm_restrictions == strategy.STRATEGY_ALARM_RESTRICTION_TYPES.RELAXED + self.strategy._alarm_restrictions in [ + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.RELAXED, + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.PERMISSIVE, + ] ) nfvi.nfvi_upgrade_start(self._release, force, self._start_upgrade_callback()) @@ -2104,6 +2110,12 @@ class QueryAlarmsStep(strategy.StrategyStep): "%s - uuid %s due to relaxed alarm " "strictness" % (nfvi_alarm.alarm_id, nfvi_alarm.alarm_uuid)) + elif (self.strategy._alarm_restrictions == + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.PERMISSIVE): + DLOG.warn("Ignoring alarm " + "%s - uuid %s due to permissive alarm " + "strictness" % (nfvi_alarm.alarm_id, + nfvi_alarm.alarm_uuid)) elif (nfvi_alarm.alarm_id not in self._ignore_alarms and nfvi_alarm.alarm_id not in self._ignore_alarms_conditional): DLOG.warn("Alarm: %s" % nfvi_alarm.alarm_id) @@ -2198,6 +2210,12 @@ class WaitDataSyncStep(strategy.StrategyStep): "%s - uuid %s due to relaxed alarm " "strictness" % (nfvi_alarm.alarm_id, nfvi_alarm.alarm_uuid)) + elif (self.strategy._alarm_restrictions == + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.PERMISSIVE): + DLOG.warn("Ignoring alarm " + "%s - uuid %s due to permissive alarm " + "strictness" % (nfvi_alarm.alarm_id, + nfvi_alarm.alarm_uuid)) elif nfvi_alarm.alarm_id not in self._ignore_alarms: nfvi_alarms.append(nfvi_alarm) else: @@ -2310,6 +2328,12 @@ class WaitAlarmsClearStep(strategy.StrategyStep): "%s - uuid %s due to relaxed alarm " "strictness" % (nfvi_alarm.alarm_id, nfvi_alarm.alarm_uuid)) + elif (self.strategy._alarm_restrictions == + strategy.STRATEGY_ALARM_RESTRICTION_TYPES.PERMISSIVE): + DLOG.warn("Ignoring alarm " + "%s - uuid %s due to permissive alarm " + "strictness" % (nfvi_alarm.alarm_id, + nfvi_alarm.alarm_uuid)) elif nfvi_alarm.alarm_id not in self._ignore_alarms: # For ignoring stale alarm(currently 750.006) if nfvi_alarm.alarm_id in self._ignore_alarms_conditional: