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


##########
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:
   @rp-, there was a 
[discussion](https://github.com/apache/cloudstack/discussions/10026) about an 
issue with the fencing that the Host is Powered off and CS tries to shut it 
down again. But I've seen cases where the host could be in the down state 
before the IPMI tries to power it off.
   @DaanHoogland, yes, I think there is an option to check the OOBM status and 
the condition should be changed with the result of it



-- 
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-unsubscr...@cloudstack.apache.org

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

Reply via email to