Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #13811 +/- ##
============================================
+ Coverage 16.26% 17.29% +1.02%
- Complexity 13434 13684 +250
============================================
Files 5667 5264 -403
Lines 500731 468560 -32171
Branches 60803 55042 -5761
============================================
- Hits 81455 81044 -411
+ Misses 410172 378444 -31728
+ Partials 9104 9072 -32
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:
|
There was a problem hiding this comment.
Pull request overview
This pull request prevents CloudStack’s HA subsystem from attempting to restart VMs that are already in VirtualMachine.State.Error, aligning HA behavior with the VM lifecycle (no normal start transition from Error) and addressing issue #13785.
Changes:
- Add an early return in
scheduleRestart(...)to avoid creating HA work and triggering side effects forError-state VMs. - Add an early return in
restart(...)so already-queued HA work forError-state VMs completes without proceeding into investigation/fencing/restart logic. - Add focused regression tests in
HighAvailabilityManagerImplTestcovering both scheduling-time and execution-time guards.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java | Adds Error-state guards in HA scheduling and worker execution paths to skip HA restart processing. |
| server/src/test/java/com/cloud/ha/HighAvailabilityManagerImplTest.java | Adds regression tests validating no HA work/side effects are triggered for Error-state VMs and normal processing continues otherwise. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
03006c2 to
250b684
Compare
250b684 to
68dd95b
Compare
Description
Fixes #13785.
When a failed deployment leaves an HA-enabled VM in
Error, HA can still enqueue restart work. The existing state/update comparison does not reject work recorded while the VM was already inError, even though the VM lifecycle has no start transition from that state.This change rejects Error-state VMs at the shared
scheduleRestart(...)entry point, before creating HA work or calling VM orchestration. It also completes previously queued HA restart work through the existingStep.Doneand DAO-update path:processWork(...)checks the VM before the HA-disabled retry path.restart(...)checks its own VM lookup before the future/running-work queries and host investigation. This covers a VM enteringErrorbetween the worker's two VM reads.The worker-entry guard applies only to HA restart work, preserving stop and destroy cleanup. VM lifecycle transitions, database schema, configuration and other HA work types are unchanged.
The PR retains one commit against
4.20and changes the existing HA implementation and test class.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate)
Not applicable.
How Has This Been Tested?
Local validation of
68dd95ba1160e8efc98ee5e48d475bc6545ed368:VMInstanceVOandHaWorkVOobjects and execute the actual dispatch, retry/completion and cancellation/investigation code. DAO, configuration and external-service boundaries use the existing Mockito test framework; worker methods are not stubbed to succeed.StorageBrowserImplTest.testGetFormattedPathsexpecting Linux path separators on Windows. The same failure was reproduced in a clean checkout of the unchanged base commit549daae0; all HA tests passed in the full run.Tests ran on Windows with Java 17 and Maven 3.9.16. The schema's native execution hook was skipped with
-Dexec.skip=true. No live database or hypervisor validation is claimed.How did you try to break this feature and the system with this change?
investigate.Investigatingand the running-work retry branch. The corrected ordering completes the item before host lookup or retry.