Added permissive alam-restriction
When doing a sw-deploy upgrade/rollback there could be mgmt affeting alarms present. These need to be ignored in some cases. This commit adds permissive mode to all strategies on the backend, but only sw-deploy on the CLI. TEST PLAN PASS: AIO-SX sw-deploy-strategy (patch), no change PASS: AIO-SX sw-deploy-strategy (patch), with permissive * mgmt_affecting alarms ignored * precheck/start used with force option Story: 2011045 Task: 50877 Change-Id: Ia16ad1a99c8efaaaec483bdaa0e9b4bde888be58 Signed-off-by: Joshua Kraitberg <joshua.kraitberg@windriver.com>
This commit is contained in:
parent
719621fe6e
commit
aa5f4303b3
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
;;
|
||||
*)
|
||||
|
@ -27,6 +27,7 @@ class StrategyAlarmRestrictionTypes(Constants):
|
||||
"""
|
||||
STRICT = Constant('strict')
|
||||
RELAXED = Constant('relaxed')
|
||||
PERMISSIVE = Constant('permissive')
|
||||
|
||||
|
||||
@six.add_metaclass(Singleton)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -62,6 +62,7 @@ class SwUpdateAlarmRestrictionTypes(Constants):
|
||||
"""
|
||||
STRICT = Constant('strict')
|
||||
RELAXED = Constant('relaxed')
|
||||
PERMISSIVE = Constant('permissive')
|
||||
|
||||
|
||||
@six.add_metaclass(Singleton)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user