-
Story
-
Resolution: Done
-
Normal
-
None
-
None
-
5
-
False
-
-
True
-
-
HBI emits messages for create/update/delete of host data. Swatch-metrics-hbi currently implements logic to translate create/update HBI events into swatch events and tracks HBI host relationships as events are processed, but does not delete them yet.
This card is to translate HBI delete events into a Swatch INSTANCE_DELETED event and to update the relationships accordingly.
Acceptance Criteria
- If swatch-metrics-hbi encounters an HBI event for DELETE and a relationship exists for the target host:
- The existing relationship is deleted
- A Swatch event is sent containing:
- Last known metadata about the host (display name, inventory_id, ...)
- Last known calculated measurements
- Timestamp of the incoming delete event, truncated to the hour of the event.
- If the target host is a hypervisor, for each affected guest:
- Update the guest relationship to reflect that it is now un-mapped.
- Re-normalize the guest's facts based to reflect that its hypervisor was deleted and send an INSTANCE_UPDATED event with changed metadata/metrics.
- If the target host is a guest and is mapped:
- No other relationship updates required.
- If the mapped hypervisor relationship exists, re-normalize the facts for the hypervisor and send an INSTANCE_UPDATED swatch event for the hypervisor. - If no relationship exists for the host that was deleted:
- send a bare swatch INSTANCE_DELTED event with any host data that was included in the incoming HBI delete event.
- Log a WARNING - If the unleash flag is enabled, no swatch events should be emitted. Emitting the swatch delete event is out of scope to this card.