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

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

core: Replace FenceExecutor in SshSoftFencingCommand

Replaces FenceExecutor with HostFenceActionExecutor in
SshSoftFencingCommand.

Change-Id: Ib2654e401ec99fd934312d77d0dd2b390dead3ff
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/SshSoftFencingCommand.java
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/38970/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SshSoftFencingCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SshSoftFencingCommand.java
index e93bfba..b8757dd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SshSoftFencingCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SshSoftFencingCommand.java
@@ -4,9 +4,13 @@
 import java.io.IOException;
 
 import org.ovirt.engine.core.bll.context.CommandContext;
+import org.ovirt.engine.core.bll.pm.HostFenceActionExecutor;
 import org.ovirt.engine.core.bll.utils.EngineSSHClient;
 import org.ovirt.engine.core.common.action.VdsActionParameters;
 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.HostPowerStatus;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.utils.ThreadUtils;
@@ -46,7 +50,7 @@
             getReturnValue().setSucceeded(false);
             return;
         }
-        if (FenceExecutor.isStatusOff(new 
FenceExecutor(getVds()).checkHostStatus())) {
+        if (isHostPoweredOff()) {
             // do not try to soft-fence if Host is reported as Down via PM
             getReturnValue().setSucceeded(false);
         }
@@ -132,6 +136,13 @@
         return false;
     }
 
+    protected boolean isHostPoweredOff() {
+        HostFenceActionExecutor executor = new 
HostFenceActionExecutor(getVds());
+        FenceOperationResult result = executor.fence(FenceActionType.STATUS);
+        return result.getStatus() == FenceOperationResult.Status.SUCCESS
+                && result.getPowerStatus() == HostPowerStatus.OFF;
+    }
+
     public ResourceManager getResourceManager() {
         // TODO: fix when ResourceManager could be injected
         return ResourceManager.getInstance();


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2654e401ec99fd934312d77d0dd2b390dead3ff
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