rafaelweingartner commented on a change in pull request #2473: CLOUDSTACK-10309 
Add option on if to VM HA power-on a OOB-shut-off-VM
URL: https://github.com/apache/cloudstack/pull/2473#discussion_r172047261
 
 

 ##########
 File path: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
 ##########
 @@ -3853,7 +3856,7 @@ private void 
handlePowerOffReportWithNoPendingJobsOnVM(final VMInstanceVO vm) {
         case Stopped:
         case Migrating:
             s_logger.info("VM " + vm.getInstanceName() + " is at " + 
vm.getState() + " and we received a power-off report while there is no pending 
jobs on it");
-            if(vm.isHaEnabled() && vm.getState() == State.Running && 
vm.getHypervisorType() != HypervisorType.VMware && vm.getHypervisorType() != 
HypervisorType.Hyperv) {
+            if(vm.isHaEnabled() && vm.getState() == State.Running && 
HaVmRestartHostUp.value() && vm.getHypervisorType() != HypervisorType.VMware && 
vm.getHypervisorType() != HypervisorType.Hyperv) {
 
 Review comment:
   @Slair1 would you mind extracting these conditions to a method (e.g. 
`shouldRestartVirtualMachine`)? With your addition the if condition will have 5 
elements, which is a lot. Extracting this bit to a method enabled documentation 
and unit test cases for these different cases.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to