Clear leftover 900.001 alarm

The Patch in Progress alarm is a leftover of legacy patching and
is normally cleared during upgrade to usm releases by querying
the software API and the sw-patch API at the same time.

Corner cases were observed where patch-alarm-manager could not
communicate with one of the APIs and the alarm was not cleared,
carrying it over to the new release.

This change checks if the 900.001 alarm is raised and clears it
as it's no longer relevant on usm releases.

Test-Plan:
PASS: - Edit patch_alarm_manager.py and restart service
      - Check if alarm is cleared

closes-bug: 2090870

Change-Id: I633c590b2457e7fbe7abbefe934b07fbeb5356aa
Signed-off-by: mmachado <mmachado@windriver.com>
This commit is contained in:
mmachado 2025-01-30 11:17:07 -03:00
parent d16a439273
commit 7893ad89ae

View File

@ -89,6 +89,19 @@ class PatchAlarmDaemon(object):
def check_patch_alarms(self):
self._handle_patch_alarms()
self._get_handle_failed_hosts()
self._handle_pip_alarm()
def _handle_pip_alarm(self):
entity_instance_id = "%s=%s" % (fm_constants.FM_ENTITY_TYPE_HOST, "controller")
# Alarm from prior release that's no longer relevant
# could've been raised inadvertently when software api is missing during upgrade
pip_alarm = self.fm_api.get_fault(fm_constants.FM_ALARM_ID_PATCH_IN_PROGRESS,
entity_instance_id)
if pip_alarm:
LOG.info("Clearing patch-in-progress alarm")
self.fm_api.clear_fault(fm_constants.FM_ALARM_ID_PATCH_IN_PROGRESS,
entity_instance_id)
def _handle_patch_alarms(self):
url = "http://%s/v1/release" % self.api_addr