Repository navigation
Record a VM.STOP event and alert when host maintenance stops a VM - #14895
Open
bhouse-nexthop wants to merge 1 commit into
Open
bhouse-nexthop wants to merge 1 commit into
bhouse-nexthop wants to merge 1 commit into
Conversation
Host maintenance can stop a VM instead of moving it: a ForceStop when no host can take it (or by the local storage strategy), or a force stop after a failed migration. Neither left a VM.STOP event or an alert, so the owner had no record of why the VM went down. Record a WARN VM.STOP event against the VM's owner and send the VM HA alert in both cases. HA work counts as maintenance when it carries the HostMaintenance reason or its host is in a maintenance state. Signed-off-by: Brad House <bhouse@nexthop.ai>
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Tested on a KVM lab with 4.22 plus this change. Setup:
Not covered in the lab, unit tests only: the force stop after a failed migration, and the last-host ForceStop with no reason set. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When host maintenance stops a VM instead of migrating it, nothing records the stop. The owner gets no
VM.STOPevent and admins get no alert, so people find out because their workload went down.This PR adds both. When an HA
ForceStopor a failed migration for maintenance leaves a VM Stopped that was Running (or Migrating) before:VM.STOPevent goes to the VM's owner:VM <name> (<uuid>) was stopped by host maintenanceALERT.USERVM, router, CPVM or SSVM), with the host name added. It followsvm.ha.alerts.enabledlike the other HA alerts.ForceStopVM.STOPevent + alerthost.maintenance.local.storage.strategy=ForceStopVM.STOPevent + alertorchestrateMigrateAwayforce-stops the VMVM.MIGRATEerror onlyVM.STOPevent + alertVM.MIGRATEerrorHA work counts as maintenance if it has the
HostMaintenancereason or its host is in a maintenance state. I left the no-hostForceStopuntagged on purpose: tagging itHostMaintenancewould make it cancellable after a management server restart, which would change behavior.The event and alert are best effort. A failure to record them is logged and doesn't affect the stop or the HA work.
No schema change. The only file changed is
HighAvailabilityManagerImpl.Relation to #13189: that PR stops
orchestrateMigrateAwayfrom force-stopping a VM after a failed migration and retries instead. This PR doesn't touchVirtualMachineManagerImpl, so the two don't conflict. With #13189 merged, the failed-migration hook simply never fires, and the twoForceStopcases still need this fix.Fixes: #14894
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Unit tests in
HighAvailabilityManagerImplTest:ForceStopand a failed migration both check for a maintenance stop. AForceStopthat fails records nothing.HostMaintenancewrites the event against the owner account and sends the alert.PrepareForMaintenanceis recorded. On anEnabledhost it isn't.The full
servermodule test suite passes.How did you try to break this feature and the system with this change?
displayvm=false) get a hidden event.Not done here: