You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "Dogface2k (via GitHub)" <gi...@apache.org> on 2026/08/06 09:52:14 UTC

[PR] server: skip HA restart for VMs in Error state [cloudstack]

Dogface2k opened a new pull request, #13811:
URL: https://github.com/apache/cloudstack/pull/13811

   ### Description
   
   This PR...
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ******************************************************************************* -->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ******************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r4034443777


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   @Dogface2k can we prevent adding the entires to _op_it_work_ / _op_ha_work_ tables when the instance is in Error state, so that Error-ed instances are never scheduled and picked up here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "Dogface2k (via GitHub)" <gi...@apache.org>.
Dogface2k commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r4314484428


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   @sureshanaparti I checked the scheduling path when the VM is already in Error, `scheduleRestart()` returns before persisting HA work or calling VM orchestration. This HA restart path therefore adds no new entry to either table for that VM. `op_it_work ` tracks VM operations separately; the presence of an existing row does not tell us that it was inserted after the VM entered Error. The guard in `restart()` is for HA work queued before the state changed. I found that the worker can reschedule such an item before reaching that guard, so I’ll fix that ordering before resolving this thread.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r3748937868


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   In restart(...), the Error-state guard runs after listRunningHaWorkForVm(...). If there is already running HA work for the VM, this work item will be rescheduled (wait) instead of being completed immediately, and you also pay the extra DAO query even though the VM state means no HA action should happen. Consider moving the VM lookup + Error-state short-circuit ahead of the running-work check so Error-state items complete right away and avoid unnecessary churn.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "Dogface2k (via GitHub)" <gi...@apache.org>.
Dogface2k commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r3749022740


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   looking at.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#issuecomment-5239329421

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/13811?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 4.14%. Comparing base ([`549daae`](https://app.codecov.io/gh/apache/cloudstack/commit/549daae01ff591adfd0926a1822b45807accde2c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`03006c2`](https://app.codecov.io/gh/apache/cloudstack/commit/03006c29ec37a9f13cf95fda3374626e54beab44?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (549daae) and HEAD (03006c2). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (549daae) | HEAD (03006c2) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               4.20   #13811       +/-   ##
   =============================================
   - Coverage     16.26%    4.14%   -12.12%     
   =============================================
     Files          5667      405     -5262     
     Lines        500731    33025   -467706     
     Branches      60803     5898    -54905     
   =============================================
   - Hits          81455     1370    -80085     
   + Misses       410172    31479   -378693     
   + Partials       9104      176     -8928     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/13811/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/13811/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.14% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/13811/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/13811?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "Dogface2k (via GitHub)" <gi...@apache.org>.
Dogface2k commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r3749022740


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   looking at.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] server: skip HA restart for VMs in Error state [cloudstack]

Posted by "Dogface2k (via GitHub)" <gi...@apache.org>.
Dogface2k commented on code in PR #13811:
URL: https://github.com/apache/cloudstack/pull/13811#discussion_r4314334053


##########
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java:
##########
@@ -600,6 +605,11 @@ protected Long restart(final HaWorkVO work) {
             logger.info("Unable to find vm: " + vmId);
             return null;
         }
+        if (VirtualMachine.State.Error.equals(vm.getState())) {
+            logger.info("Skipping HA restart for VM {} because it is in Error state", vm);
+            return null;
+        }

Review Comment:
   > @Dogface2k can we prevent adding the entires to _op_it_work_ / _op_ha_work_ tables when the instance is in Error state, so that Error-ed instances are never scheduled and picked up here.
   
   I totally missed your comment I am looking at this now sorry!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org