Clear deploy host alarm when host report inventory

After the "deploy host" command is executed to deploy a
software release, an alarm is created by [1] to indicate
success/failure and follow-up actions needed.

This commit clears the success alarm when the host
reboots running with the new software release.

[1] https://review.opendev.org/c/starlingx/update/+/916688

Test Case
PASS: run "deploy host", verify the alarm is created, unlock
      the host and verify the alarm is cleared after host
      reports inventory
PASS: lock/unlock host
PASS: install/bootstrap/unlock AIO-DX

Story: 2010676
Task: 49933

Depends-on: https://review.opendev.org/c/starlingx/update/+/916688

Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
Change-Id: Ia4494142b9f5487a0ddf472833d6c80719382f8a
This commit is contained in:
Heitor Matsui 2024-04-23 16:21:26 -03:00
parent 5ca9c6f78f
commit cac8635e7a
1 changed files with 13 additions and 0 deletions

View File

@ -6619,6 +6619,7 @@ class ConductorManager(service.PeriodicService):
self.dbapi.ihost_update(
host_uuid,
{'inv_state': constants.INV_STATE_INITIAL_INVENTORIED})
self._clear_deploy_alarm(host_uuid)
except exception.ServerNotFound:
LOG.error("initial_inventory_completed invalid host_uuid %s" %
host_uuid)
@ -19205,6 +19206,18 @@ class ConductorManager(service.PeriodicService):
def _audit_prune_stale_backup_alarms(self, context):
self._prune_stale_backup_alarms(context)
def _clear_deploy_alarm(self, host_uuid):
"""
Clear the deploy alarm after host applies new software release and reboots
:param host_uuid: uuid of the host associated with the alarm
"""
host = self.dbapi.ihost_get(host_uuid)
entity_instance_id = "%s=%s" % (fm_constants.FM_ENTITY_TYPE_HOST, host.hostname)
LOG.info("Clearing deploy host alarm %s for %s" % (
fm_constants.FM_ALARM_ID_USM_DEPLOY_HOST_SUCCESS_RR, entity_instance_id))
self.fm_api.clear_fault(fm_constants.FM_ALARM_ID_USM_DEPLOY_HOST_SUCCESS_RR,
entity_instance_id)
def get_all_certs(self, context):
"""
list all the platform certificates with the all the certificate values