Skip to content

Emit host event for maintenance prepare failure state#7

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-action-event-for-error-in-prepare
Draft

Emit host event for maintenance prepare failure state#7
Copilot wants to merge 3 commits into
mainfrom
copilot/add-action-event-for-error-in-prepare

Conversation

Copilot AI commented Jun 14, 2026

Copy link
Copy Markdown

When a host transitions into ErrorInPrepareForMaintenance, CloudStack did not emit a corresponding event, leaving operators without an event signal for this maintenance-preparation failure path. This change adds a dedicated error event and emits it at the state transition.

  • Add maintenance prepare error event

    • Introduce EventTypes.EVENT_MAINTENANCE_PREPARE_ERROR = "MAINT.PREPARE.ERROR"
    • Register the event with Host.class in EventTypes.entityEventDetails
  • Emit event on failure transition

    • Update ResourceManagerImpl.setHostIntoErrorInPrepareForMaintenance(...) to publish a completed action event after the resource state transition
    • Use EventVO.LEVEL_ERROR so the event is distinguishable from the successful maintenance-prepare flow
  • Cover the new behavior

    • Extend ResourceManagerImplTest to verify the error event is emitted
    • Add an assertion for the event-to-entity mapping
ActionEventUtils.onCompletedActionEvent(
        CallContext.current().getCallingUserId(),
        CallContext.current().getCallingAccountId(),
        EventVO.LEVEL_ERROR,
        EventTypes.EVENT_MAINTENANCE_PREPARE_ERROR,
        String.format("failed to prepare host %s for maintenance due to migration or VM state errors", host),
        host.getId(), null, 0);

Copilot AI changed the title [WIP] Add event emission for ErrorInPrepareForMaintenance state Emit host event for maintenance prepare failure state Jun 14, 2026
Copilot AI requested a review from DaanHoogland June 14, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants