Oved Ourfali has uploaded a new change for review.

Change subject: core: fix fence-status operation
......................................................................

core: fix fence-status operation

When the fencing policy is null, we check that the host is compatible
with cluster level 3.0, which is wrong. This patch changes that by
not checking cluster level when fencing policy is null. Also
getMinimalSupportedVersion was modified to throw
IllegalArgumentException when null is passed as parameter.

Change-Id: Idecf91da729cbd8744f894c341b7044cc791853d
Bug-Url: https://bugzilla.redhat.com/1130791
Signed-off-by: Oved Ourfali <[email protected]>
Signed-off-by: Martin Perina <[email protected]>
(cherry picked from commit 7039195f1019371a1edbcf3b97a82a098e77c868)
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/FencingPolicyHelper.java
2 files changed, 17 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/31603/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
index 30afdd9..95ef4bd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
@@ -62,7 +62,9 @@
         _vds = vds;
         _action = actionType;
         this.fencingPolicy = fencingPolicy;
-        minVersionSupportingFencingPol = 
FencingPolicyHelper.getMinimalSupportedVersion(fencingPolicy);
+        if (fencingPolicy != null) {
+            minVersionSupportingFencingPol = 
FencingPolicyHelper.getMinimalSupportedVersion(fencingPolicy);
+        }
     }
 
     public boolean findProxyHost() {
@@ -424,7 +426,9 @@
                 }
 
                 // check if host supports minimal cluster level needed by 
fencing policy
-                ret = ret && 
_vds.getSupportedClusterVersionsSet().contains(minVersionSupportingFencingPol);
+                if (fencingPolicy != null) {
+                    ret = ret && 
_vds.getSupportedClusterVersionsSet().contains(minVersionSupportingFencingPol);
+                }
 
                 return ret;
             }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/FencingPolicyHelper.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/FencingPolicyHelper.java
index dbd4a2c..ee5ac4f 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/FencingPolicyHelper.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/FencingPolicyHelper.java
@@ -14,18 +14,20 @@
      * Returns minimal cluster version, that supports specified fencing policy
      */
     public static Version getMinimalSupportedVersion(FencingPolicy fp) {
+        if (fp == null) {
+            throw new IllegalArgumentException();
+        }
+
         // Version 2.2 is not supported by VDSM, but it's still contained in 
version list,
         // so we cannot just get first element from version list
         Version ver = Version.v3_0;
-        if (fp != null) {
-            if (fp.isSkipFencingIfSDActive()) {
-                for (Version v : Version.ALL) {
-                    // Version 2.2 is included in version list, but it's not 
included in db to set up config values
-                    if (v.compareTo(Version.v3_0) >= 0 &&
-                            
FeatureSupported.isSkipFencingIfSDActiveSupported(v)) {
-                        ver = v;
-                        break;
-                    }
+        if (fp.isSkipFencingIfSDActive()) {
+            for (Version v : Version.ALL) {
+                // Version 2.2 is included in version list, but it's not 
included in db to set up config values
+                if (v.compareTo(Version.v3_0) >= 0 &&
+                        FeatureSupported.isSkipFencingIfSDActiveSupported(v)) {
+                    ver = v;
+                    break;
                 }
             }
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idecf91da729cbd8744f894c341b7044cc791853d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Oved Ourfali <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to