Shireesh Anjal has uploaded a new change for review.

Change subject: gluster: added cluster level check
......................................................................

gluster: added cluster level check

refreshHeavyWeightData uses the vdsm verb glusterVolumeStatus
which is not available in cluster level 3.1. So added a check
in GlusterManager to not perform the refresh in case of a 3.1
cluster

Change-Id: Id3944e8b1d8d82eb19643b99f606da2364d6b582
Bug-Url: https://bugzilla.redhat.com/920575
Signed-off-by: Shireesh Anjal <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterManagerTest.java
2 files changed, 25 insertions(+), 6 deletions(-)


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

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
index 4a08b14..454c94f 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
@@ -45,6 +45,7 @@
 import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeAdvancedDetailsVDSParameters;
 import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumesListVDSParameters;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 import 
org.ovirt.engine.core.dal.dbbroker.auditloghandling.gluster.GlusterAuditLogUtil;
 import org.ovirt.engine.core.dao.VdsDAO;
@@ -785,7 +786,7 @@
         log.debug("Refreshing Gluster Data [heavyweight]");
 
         for (VDSGroup cluster : getClusterDao().getAll()) {
-            if (cluster.supportsGlusterService()) {
+            if (cluster.getcompatibility_version().compareTo(Version.v3_2) >= 
0 && cluster.supportsGlusterService()) {
                 try {
                     refreshClusterHeavyWeightData(cluster);
                 } catch (Exception e) {
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterManagerTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterManagerTest.java
index fde740b..a6b6b7e 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterManagerTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterManagerTest.java
@@ -53,6 +53,7 @@
 import org.ovirt.engine.core.common.vdscommands.VDSParametersBase;
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import 
org.ovirt.engine.core.dal.dbbroker.auditloghandling.gluster.GlusterAuditLogUtil;
 import org.ovirt.engine.core.dao.VdsDAO;
 import org.ovirt.engine.core.dao.VdsDynamicDAO;
@@ -152,18 +153,17 @@
         existingServers.add(existingServer2);
         existingServers.add(createServer(SERVER_ID_3, SERVER_NAME_3));
 
-        createCluster();
-
         existingDistVol = createDistVol(DIST_VOL_NAME, EXISTING_VOL_DIST_ID);
         existingReplVol = createReplVol();
     }
 
-    private void createCluster() {
+    private void createCluster(Version version) {
         existingCluster = new VDSGroup();
         existingCluster.setId(CLUSTER_ID);
         existingCluster.setname("cluster");
         existingCluster.setGlusterService(true);
         existingCluster.setVirtService(false);
+        existingCluster.setcompatibility_version(version);
     }
 
     private VDS createServer(Guid serverId, String hostname) {
@@ -515,6 +515,7 @@
 
     @Test
     public void testRefreshLightWeight() throws Exception {
+        createCluster(Version.v3_2);
         setupMocks();
 
         glusterManager.refreshLightWeightData();
@@ -522,13 +523,27 @@
     }
 
     @Test
-    public void testRefreshHeavyWeight() throws Exception {
+    public void testRefreshHeavyWeightFor31() throws Exception {
+        createCluster(Version.v3_1);
+        setupMocks();
+        glusterManager.refreshHeavyWeightData();
+        verifyMocksForHeavyWeight();
+    }
+
+    @Test
+    public void testRefreshHeavyWeightFor32() throws Exception {
+        createCluster(Version.v3_2);
         setupMocks();
         glusterManager.refreshHeavyWeightData();
         verifyMocksForHeavyWeight();
     }
 
     private void verifyMocksForHeavyWeight() {
+        if (existingCluster.getcompatibility_version() == Version.v3_1) {
+            // nothing should happen if the cluster has compatibility level 3.1
+            return;
+        }
+
         InOrder inOrder = inOrder(clusterDao, clusterUtils, volumeDao, 
glusterManager, brickDao);
 
         // all clusters fetched from db
@@ -617,7 +632,10 @@
         volume.addAccessProtocol(AccessProtocol.NFS);
 
         GlusterBrickEntity brick =
-                new GlusterBrickEntity(NEW_VOL_ID, 
existingServer1.getStaticData(), "/export/testVol1", GlusterStatus.UP);
+                new GlusterBrickEntity(NEW_VOL_ID,
+                        existingServer1.getStaticData(),
+                        "/export/testVol1",
+                        GlusterStatus.UP);
         brick.setBrickOrder(0);
         volume.addBrick(brick);
 


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

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

Reply via email to