leo79901 commented on code in PR #10039:
URL: https://github.com/apache/cloudstack/pull/10039#discussion_r1869764391
##########
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/kvm/ha/KVMHAProvider.java:
##########
@@ -84,18 +84,24 @@ public boolean recover(Host r) throws HARecoveryException {
@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 (Host.Status.DOWN.equals(r.getStatus())) {
+ LOG.info("Host " + r.getName() + " is already down.
Returning success.");
+ return true;
+ } else {
+ final OutOfBandManagementResponse resp =
outOfBandManagementService.executePowerOperation(r, PowerOperation.OFF, null);
+ return resp.getSuccess();
+ }
} else {
- logger.warn("OOBM fence operation failed for this host " +
r.getName());
+ LOG.warn("OOBM fence operation failed for this host " +
r.getName());
Review Comment:
Yes , you are right.
--
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]