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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]