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

Change subject: core: Fix skipped status in fencing
......................................................................

core: Fix skipped status in fencing

Fixes the distinction between two types of skipping fencing operation:

 1. Skipped due to status
      - on/off operation is skipped because host power status if already
        on/off

 2. Skipped due to fencing policy
      - on/off operation is skipped becuase host is non responsive but
        it's still connected to storage

Change-Id: Ia0c2a76d10a7e501ed5a53b323acb251c05c06fb
Bug-Url: https://bugzilla.redhat.com/1192596
Signed-off-by: Martin Perina <mper...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FenceStatusReturnValue.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
3 files changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/37839/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
index 1194a78..94b184e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
@@ -469,7 +469,7 @@
     }
 
     private void handleError(VDSStatus lastStatus, final VDSReturnValue 
vdsReturnValue, FenceAgentOrder order) {
-        if (!((FenceStatusReturnValue) 
(vdsReturnValue.getReturnValue())).getIsSkipped()) {
+        if (!((FenceStatusReturnValue) 
(vdsReturnValue.getReturnValue())).getIsSkippedDueToStatus()) {
             // Since this is a non-transactive command , restore last status
             setSucceeded(false);
             log.errorFormat("Failed to {0} VDS using {1} Power Management 
agent", getParameters().getAction()
@@ -685,7 +685,7 @@
         if (returnValue instanceof FenceStatusReturnValue) {
             fenceResult = (FenceStatusReturnValue) returnValue;
         }
-        return fenceResult != null && fenceResult.getIsSkipped();
+        return fenceResult != null && fenceResult.getIsSkippedDueToPolicy();
     }
 
     protected void handleFencingSkippedDueToPolicy(VDSReturnValue 
vdsReturnValue) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FenceStatusReturnValue.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FenceStatusReturnValue.java
index c12d619..eac8348 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FenceStatusReturnValue.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FenceStatusReturnValue.java
@@ -7,7 +7,8 @@
 public class FenceStatusReturnValue implements Serializable {
     private static final long serialVersionUID = 8070963676213797507L;
     // indicates that operation was skipped because Host is already in 
requested state.
-    public static final String SKIPPED = "skipped";
+    public static final String SKIPPED_DUE_TO_STATUS = "skipped_due_to_status";
+    public static final String SKIPPED_DUE_TO_POLICY = "skipped";
     public static final String INITIATED = "initiated";
     public FenceStatusReturnValue(String status, String message) {
         _status = status;
@@ -30,8 +31,12 @@
         return (StringHelper.isNullOrEmpty(getMessage()));
     }
 
-    public boolean getIsSkipped() {
-        return SKIPPED.equalsIgnoreCase(_status);
+    public boolean getIsSkippedDueToStatus() {
+        return SKIPPED_DUE_TO_STATUS.equalsIgnoreCase(_status);
+    }
+
+    public boolean getIsSkippedDueToPolicy() {
+        return SKIPPED_DUE_TO_POLICY.equalsIgnoreCase(_status);
     }
 
     public boolean getIsInitiated() {
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
index 8a1d28c..946cadd 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
@@ -122,7 +122,7 @@
     * Handles cases where fencing operation was skipped (host is already in 
requested state)
     */
     private void handleSkippedOperation() {
-        FenceStatusReturnValue fenceStatusReturnValue = new 
FenceStatusReturnValue(FenceStatusReturnValue.SKIPPED, "");
+        FenceStatusReturnValue fenceStatusReturnValue = new 
FenceStatusReturnValue(FenceStatusReturnValue.SKIPPED_DUE_TO_STATUS, "");
         AuditLogableBase auditLogable = new AuditLogableBase();
         auditLogable.addCustomValue("HostName",
                 
(DbFacade.getInstance().getVdsDao().get(getParameters().getTargetVdsID())).getName());


-- 
To view, visit http://gerrit.ovirt.org/37839
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0c2a76d10a7e501ed5a53b323acb251c05c06fb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to