Martin Peřina has uploaded a new change for review.

Change subject: core: Replace FenceExecutor in PmHealthCheckManager
......................................................................

core: Replace FenceExecutor in PmHealthCheckManager

Replaces FenceExecutor with HostFenceActionExecutor in
PmHealthCheckManager.

Change-Id: I5bf7cea4e3116e7c63b9f6b118379b120c077ec9
Bug-Url: https://bugzilla.redhat.com/1182510
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/38971/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
index b31e7cc..851021a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
@@ -11,7 +11,6 @@
 import javax.inject.Singleton;
 
 import org.ovirt.engine.core.bll.Backend;
-import org.ovirt.engine.core.bll.FenceExecutor;
 import org.ovirt.engine.core.bll.RestartVdsCommand;
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.bll.pm.PowerManagementHelper.AgentsIterator;
@@ -23,9 +22,11 @@
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.pm.FenceActionType;
+import org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult;
+import 
org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult.Status;
+import org.ovirt.engine.core.common.businessentities.pm.HostPowerStatus;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
-import org.ovirt.engine.core.common.vdscommands.VDSFenceReturnValue;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AlertDirector;
@@ -212,7 +213,7 @@
      * doesn't matter whether that answer is "on" or "off".
      */
     private boolean isHealthy(FenceAgent agent, VDS host) {
-        return new FenceExecutor(host).fence(FenceActionType.STATUS, 
agent).getSucceeded();
+        return new HostFenceActionExecutor(host).fence(FenceActionType.STATUS, 
agent).getStatus() == Status.SUCCESS;
     }
 
     private void waitUntilFencingAllowed() {
@@ -263,8 +264,7 @@
             RestartVdsCommand<FenceVdsActionParameters> restartVdsCommand =
                     new RestartVdsCommand<FenceVdsActionParameters>(new
                     FenceVdsActionParameters(host.getId(), 
FenceActionType.STATUS));
-            VDSFenceReturnValue returnValue = new 
FenceExecutor(host).checkHostStatus();
-            if (FenceExecutor.isStatusOff(returnValue)) {
+            if (isHostPoweredOff(host)) {
                 VdcReturnValueBase retValue = 
Backend.getInstance().runInternalAction(VdcActionType.RestartVds, 
restartVdsCommand.getParameters());
                 if (retValue!= null && retValue.getSucceeded()) {
                     log.info("Host '{}' was started successfully by PM Health 
Check Manager",
@@ -314,6 +314,13 @@
         }
     }
 
+    protected boolean isHostPoweredOff(VDS host) {
+        HostFenceActionExecutor executor = new HostFenceActionExecutor(host);
+        FenceOperationResult result = executor.fence(FenceActionType.STATUS);
+        return result.getStatus() == Status.SUCCESS
+                && result.getPowerStatus() == HostPowerStatus.OFF;
+    }
+
     private static class PmHealth {
         public PmHealth(VDS host) {
             super();


-- 
To view, visit https://gerrit.ovirt.org/38971
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bf7cea4e3116e7c63b9f6b118379b120c077ec9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to