Avoid raising unknown alarms

During feature testing in lab, it was noticed that some
sysinv API errors resulted in UUID retrieval failures from
sysinv DB (this bug was already fixed in another commit
to avoid sysinv api failures). In such scenarios, cert-alarm
would raise an alarm with UUID=unknown. The user would then
have to manually remove these alarms.
Adding a check to log the error condition and skip raising
unknown uuid alarms. The next round of audit will pick up
any alarms to be raised in case of intermittent sysinv
failures.

Test Plan:
PASS: Verify that any sysinv API failures suppress
      raising alarms with UUID=unknown entity id.

Story: 2008946
Task: 42852

Signed-off-by: Sabeel Ansari <Sabeel.Ansari@windriver.com>
Change-Id: Icf2b6c584bab6ea3189d85d7877804dfccdf5822
This commit is contained in:
Sabeel Ansari 2021-10-27 15:09:29 -04:00
parent 2a8edfa624
commit 8e6ce5bf11
1 changed files with 8 additions and 0 deletions

View File

@ -150,6 +150,14 @@ class FaultApiMgr(object):
else fm_constants.FM_ALARM_ID_CERT_EXPIRING_SOON
entity_inst_id = self.get_entity_instance_id(cert_name)
# If case of api errors during data collection, we do not want to raise alarms with
# "unknown" UUID (because we will need to clear such alarms manually). In such a case,
# we log the error and skip the alarm raise. Subsequent audit runs will raise the alarms.
if "uuid=unknown" in entity_inst_id:
LOG.error('set_fault called for certificate %s with unknown UUID. Suppressing alarm' %
cert_name)
return
try:
if state == fm_constants.FM_ALARM_STATE_SET:
# Raise alarm only if alarm does not already exist