controllerfs-modify failed due to ialarm_get_all error
The controllerfs-modify and host-swact commands trigger get_alarms_degrade query when the host is in degraded state. The get_alarms_degrade method still uses the database query ialarm_get_all() which is no longer supported. As a result, the command failed due to no attribute error. This update modifies get_alarms_degrade to query alarms via fmclient. Closes-Bug: 1793552 Change-Id: I92ab034a43ceed7f372ba63f5f5fb412f1907281 Signed-off-by: Tao Liu <tao.liu@windriver.com>
This commit is contained in:
parent
001e02ab27
commit
8ea2fa94d7
@ -369,6 +369,7 @@ def _check_controller_state():
|
||||
# as the resize itself will clear the degrade.
|
||||
health_helper = health.Health(pecan.request.dbapi)
|
||||
degrade_alarms = health_helper.get_alarms_degrade(
|
||||
pecan.request.context,
|
||||
alarm_ignore_list=[fm_constants.FM_ALARM_ID_FS_USAGE],
|
||||
entity_instance_id_filter="controller-")
|
||||
allowed_resize = False
|
||||
|
@ -5312,6 +5312,7 @@ class HostController(rest.RestController):
|
||||
constants.AVAILABILITY_DEGRADED):
|
||||
health_helper = health.Health(pecan.request.dbapi)
|
||||
degrade_alarms = health_helper.get_alarms_degrade(
|
||||
pecan.request.context,
|
||||
alarm_ignore_list=[
|
||||
fm_constants.FM_ALARM_ID_HA_SERVICE_GROUP_STATE,
|
||||
fm_constants.FM_ALARM_ID_HA_SERVICE_GROUP_REDUNDANCY,
|
||||
|
@ -121,10 +121,10 @@ class Health(object):
|
||||
|
||||
return success, allowed, affecting
|
||||
|
||||
def get_alarms_degrade(self, alarm_ignore_list=[],
|
||||
def get_alarms_degrade(self, context, alarm_ignore_list=[],
|
||||
entity_instance_id_filter=""):
|
||||
"""Return all the alarms that cause the degrade"""
|
||||
db_alarms = self._dbapi.ialarm_get_all(include_suppress=True)
|
||||
db_alarms = fmclient(context).alarm.list(include_suppress=True)
|
||||
degrade_alarms = []
|
||||
|
||||
for db_alarm in db_alarms:
|
||||
|
Loading…
Reference in New Issue
Block a user