File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/kvm/ha Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -84,18 +84,24 @@ public boolean recover(Host r) throws HARecoveryException {
8484
8585 @ Override
8686 public boolean fence (Host r ) throws HAFenceException {
87-
8887 try {
89- if (outOfBandManagementService .isOutOfBandManagementEnabled (r )){
90- final OutOfBandManagementResponse resp = outOfBandManagementService .executePowerOperation (r , PowerOperation .OFF , null );
91- return resp .getSuccess ();
88+ // host exists and is managed OOB
89+ if (r != null && outOfBandManagementService .isOutOfBandManagementEnabled (r )) {
90+ // check host status
91+ if (Host .Status .DOWN .equals (r .getStatus ())) {
92+ LOG .info ("Host " + r .getName () + " is already down. Returning success." );
93+ return true ;
94+ } else {
95+ final OutOfBandManagementResponse resp = outOfBandManagementService .executePowerOperation (r , PowerOperation .OFF , null );
96+ return resp .getSuccess ();
97+ }
9298 } else {
93- logger .warn ("OOBM fence operation failed for this host " + r .getName ());
99+ LOG .warn ("OOBM fence operation failed for this host " + r .getName ());
94100 return false ;
95101 }
96- } catch (Exception e ){
97- logger .warn ("OOBM service is not configured or enabled for this host " + r .getName () + " error is " + e .getMessage ());
98- throw new HAFenceException ("OBM service is not configured or enabled for this host " + r .getName () , e );
102+ } catch (Exception e ) {
103+ LOG .warn ("OOBM service is not configured or enabled for this host " + r .getName () + " error is " + e .getMessage ());
104+ throw new HAFenceException ("OBM service is not configured or enabled for this host " + r .getName (), e );
99105 }
100106 }
101107
You can’t perform that action at this time.
0 commit comments