slavkap commented on code in PR #10059:
URL: https://github.com/apache/cloudstack/pull/10059#discussion_r1877873798


##########
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/kvm/ha/KVMHAProvider.java:
##########
@@ -75,28 +76,34 @@ public boolean recover(Host r) throws HARecoveryException {
                 final OutOfBandManagementResponse resp = 
outOfBandManagementService.executePowerOperation(r, PowerOperation.RESET, null);
                 return resp.getSuccess();
             } else {
-                LOG.warn("OOBM recover operation failed for the host " + 
r.getName());
+                logger.warn("OOBM recover operation failed for the host " + 
r.getName());
                 return false;
             }
         } catch (Exception e){
-            LOG.warn("OOBM service is not configured or enabled for this host 
" + r.getName() + " error is " + e.getMessage());
+            logger.warn("OOBM service is not configured or enabled for this 
host " + r.getName() + " error is " + e.getMessage());
             throw new HARecoveryException(" OOBM service is not configured or 
enabled for this host " + r.getName(), e);
         }
     }
 
     @Override
     public boolean fence(Host r) throws HAFenceException {
-
         try {
-            if (outOfBandManagementService.isOutOfBandManagementEnabled(r)){
-                final OutOfBandManagementResponse resp = 
outOfBandManagementService.executePowerOperation(r, PowerOperation.OFF, null);
-                return resp.getSuccess();
+            // host exists and is managed OOB
+            if (r != null && 
outOfBandManagementService.isOutOfBandManagementEnabled(r)) {
+                // check host status
+                if (Status.Down.equals(r.getStatus())) {

Review Comment:
   @DaanHoogland, my concern here is that host's status could be `Down` but in 
reality to be still running. With this there is an option the virtual machines 
started to a neighbor host to be left running on the previous one.
   Maybe it is better to check the OOBM status rather the host's.
   Unfortunately now I don't have environment with IPMI setup and cannot test 
this change.
   Probably here and @rp- could give some advice.
   



-- 
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]

Reply via email to