Sahina Bose has uploaded a new change for review.

Change subject: engine: Added compat check for gluster task actions
......................................................................

engine: Added compat check for gluster task actions

Added cluster compatibility checks for actions that
depend on gluster task management support in vdsm

Change-Id: I70ee8230253b04141133ccb639e00531086fd5bd
Bug-Url: https://bugzilla.redhat.com/1200294
Signed-off-by: Sahina Bose <sab...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBricksCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
11 files changed, 141 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/39232/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java
index 0a269ec..7ba809c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java
@@ -16,6 +16,7 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.gluster.GlusterFeatureSupported;
 import org.ovirt.engine.core.common.job.ExternalSystemType;
 import org.ovirt.engine.core.common.job.JobExecutionStatus;
 import org.ovirt.engine.core.common.job.Step;
@@ -41,6 +42,11 @@
             return false;
         }
 
+        if 
(!GlusterFeatureSupported.glusterAsyncTasks(getVdsGroup().getcompatibility_version()))
 {
+            addCanDoActionMessageVariable("compatibilityVersion", 
getVdsGroup().getcompatibility_version().getValue());
+            return 
failCanDoAction(VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL);
+        }
+
         if (!glusterVolume.isOnline()) {
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED);
         }
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java
index c9516b6..4c27dc6 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java
@@ -1,11 +1,15 @@
 package org.ovirt.engine.core.bll.gluster;
 
+import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
+
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.ClassRule;
 import org.mockito.Mock;
 import org.ovirt.engine.core.bll.interfaces.BackendInternal;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
@@ -13,12 +17,18 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.dao.gluster.GlusterBrickDao;
 import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.utils.MockConfigRule;
 
 public abstract class AbstractRemoveGlusterVolumeBricksCommandTest {
+
+    protected static final Version SUPPORTED_VERSION = new Version(3, 4);
+    protected static final Version UNSUPPORTED_VERSION = new Version(3, 3);
 
     @Mock
     GlusterVolumeDao volumeDao;
@@ -29,6 +39,14 @@
     @Mock
     protected VDSBrokerFrontend vdsBrokerFrontend;
 
+    @Mock
+    protected VDSGroup vdsGroup;
+
+    @ClassRule
+    public static MockConfigRule mcr = new MockConfigRule(
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
SUPPORTED_VERSION.getValue(), true),
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
UNSUPPORTED_VERSION.getValue(), false));
+
     protected final Guid volumeWithRemoveBricksTask = new 
Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5");
     protected final Guid volumeWithoutAsyncTask = new 
Guid("000000000000-0000-0000-0000-00000003");
     protected final Guid volumeWithoutRemoveBricksTask = new 
Guid("000000000000-0000-0000-0000-00000004");
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
index 2a1d631..be1bffe 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
@@ -32,6 +32,7 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.errors.VDSError;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.job.JobExecutionStatus;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.common.vdscommands.VDSParametersBase;
@@ -71,6 +72,8 @@
         
doReturn(getVolumeWithRemoveBricksTaskNull(volumeWithRemoveBricksTaskNull)).when(volumeDao)
                 .getById(volumeWithRemoveBricksTaskNull);
         doReturn(null).when(volumeDao).getById(null);
+        doReturn(SUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        doReturn(vdsGroup).when(command).getVdsGroup();
     }
 
     private Object getVolumeWithRemoveBricksTaskNull(Guid volumeId) {
@@ -167,6 +170,20 @@
     }
 
     @Test
+    public void canDoActionFailsOnCompatVersion() {
+        cmd =
+                spy(new CommitRemoveGlusterVolumeBricksCommand(new 
GlusterVolumeRemoveBricksParameters(volumeWithRemoveBricksTask,
+                        getBricks(volumeWithRemoveBricksTask))));
+
+        prepareMocks(cmd);
+        
doReturn(UNSUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        assertFalse(cmd.canDoAction());
+        assertTrue(cmd.getReturnValue()
+                .getCanDoActionMessages()
+                
.contains(VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL.toString()));
+    }
+
+    @Test
     public void canDoActionFailsOnVolumeWithoutAsyncTask() {
         cmd =
                 spy(new CommitRemoveGlusterVolumeBricksCommand(new 
GlusterVolumeRemoveBricksParameters(volumeWithoutAsyncTask,
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommandTest.java
index e4e5dea..9f706fb 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommandTest.java
@@ -4,16 +4,19 @@
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
+import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
@@ -21,20 +24,34 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
+import org.ovirt.engine.core.common.config.ConfigValues;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.utils.MockConfigRule;
 
 @RunWith(MockitoJUnitRunner.class)
 public class StartRebalanceGlusterVolumeCommandTest {
+    private static final Version SUPPORTED_VERSION = new Version(3, 4);
+    private static final Version UNSUPPORTED_VERSION = new Version(3, 3);
 
     @Mock
     GlusterVolumeDao volumeDao;
 
-    private Guid volumeId1 = new Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5");
-    private Guid volumeId2 = new Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e");
-    private Guid volumeId3 = new Guid("000000000000-0000-0000-0000-00000003");
-    private Guid volumeId4 = new Guid("000000000000-0000-0000-0000-00000004");
-    private Guid CLUSTER_ID = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+    private final Guid volumeId1 = new 
Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5");
+    private final Guid volumeId2 = new 
Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e");
+    private final Guid volumeId3 = new 
Guid("000000000000-0000-0000-0000-00000003");
+    private final Guid volumeId4 = new 
Guid("000000000000-0000-0000-0000-00000004");
+    private final Guid CLUSTER_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+
+    @ClassRule
+    public static MockConfigRule mcr = new MockConfigRule(
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
UNSUPPORTED_VERSION.getValue(), false),
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
SUPPORTED_VERSION.getValue(), true));
+
+    @Mock
+    protected VDSGroup vdsGroup;
 
     /**
      * The command under test.
@@ -49,6 +66,8 @@
         doReturn(getReplicatedVolume(volumeId3, 
2)).when(volumeDao).getById(volumeId3);
         doReturn(getReplicatedVolume(volumeId4, 
4)).when(volumeDao).getById(volumeId4);
         doReturn(null).when(volumeDao).getById(null);
+        doReturn(SUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        doReturn(vdsGroup).when(command).getVdsGroup();
     }
 
     private VDS getVds(VDSStatus status) {
@@ -142,4 +161,15 @@
         assertFalse(cmd.canDoAction());
     }
 
+    @Test
+    public void canDoActionFailsOnCompat() {
+        cmd = spy(createTestCommand(volumeId1));
+        prepareMocks(cmd);
+        
doReturn(UNSUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        assertFalse(cmd.canDoAction());
+        assertTrue(cmd.getReturnValue()
+                .getCanDoActionMessages()
+                
.contains(VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL.toString()));
+    }
+
 }
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBricksCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBricksCommandTest.java
index a204e75..314b17f 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBricksCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBricksCommandTest.java
@@ -8,12 +8,14 @@
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatcher;
@@ -24,6 +26,7 @@
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters;
 import org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
@@ -31,18 +34,24 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VDSError;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.common.vdscommands.VDSParametersBase;
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.utils.MockConfigRule;
 
 @RunWith(MockitoJUnitRunner.class)
 public class StartRemoveGlusterVolumeBricksCommandTest {
+    private static final Version SUPPORTED_VERSION = new Version(3, 4);
+    private static final Version UNSUPPORTED_VERSION = new Version(3, 3);
 
     @Mock
     GlusterVolumeDao volumeDao;
@@ -56,6 +65,14 @@
     private final Guid volumeId2 = new 
Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e");
 
     private final Guid CLUSTER_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+
+    @ClassRule
+    public static MockConfigRule mcr = new MockConfigRule(
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
UNSUPPORTED_VERSION.getValue(), false),
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
SUPPORTED_VERSION.getValue(), true));
+
+    @Mock
+    protected VDSGroup vdsGroup;
 
     GlusterAsyncTask asyncTaskToBeReturned = new GlusterAsyncTask();
     /**
@@ -88,6 +105,8 @@
         
doReturn(getSingleBrickVolume(volumeId1)).when(volumeDao).getById(volumeId1);
         
doReturn(getMultiBrickVolume(volumeId2)).when(volumeDao).getById(volumeId2);
         doReturn(null).when(volumeDao).getById(null);
+        doReturn(SUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        doReturn(vdsGroup).when(command).getVdsGroup();
     }
 
     private VDS getVds(VDSStatus status) {
@@ -200,4 +219,16 @@
         prepareMocks(cmd);
         assertFalse(cmd.canDoAction());
     }
+
+    @Test
+    public void canDoActionFailsOnCompat() {
+        cmd = spy(createTestCommand(volumeId2, 0));
+        prepareMocks(cmd);
+        
doReturn(UNSUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        assertFalse(cmd.canDoAction());
+        assertTrue(cmd.getReturnValue()
+                .getCanDoActionMessages()
+                
.contains(VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL.toString()));
+
+    }
 }
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommandTest.java
index a57a29b..dd2ec13 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRebalanceGlusterVolumeCommandTest.java
@@ -15,12 +15,14 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
 import org.hamcrest.Matcher;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatcher;
@@ -32,6 +34,7 @@
 import org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask;
 import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
@@ -40,6 +43,7 @@
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VDSError;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
 import org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend;
@@ -49,10 +53,14 @@
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.utils.MockConfigRule;
 
 @RunWith(MockitoJUnitRunner.class)
 public class StopRebalanceGlusterVolumeCommandTest {
+    private static final Version SUPPORTED_VERSION = new Version(3, 4);
+    private static final Version UNSUPPORTED_VERSION = new Version(3, 3);
 
     @Mock
     GlusterVolumeDao volumeDao;
@@ -61,11 +69,19 @@
     @Mock
     protected VDSBrokerFrontend vdsBrokerFrontend;
 
-    private Guid volumeWithRebalanceTask = new 
Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5");
-    private Guid volumeWithRebalanceTaskCompleted = new 
Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e");
-    private Guid volumeWithoutAsyncTask = new 
Guid("000000000000-0000-0000-0000-00000003");
-    private Guid volumeWithoutRebalanceTask = new 
Guid("000000000000-0000-0000-0000-00000004");
-    private Guid CLUSTER_ID = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+    private final Guid volumeWithRebalanceTask = new 
Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5");
+    private final Guid volumeWithRebalanceTaskCompleted = new 
Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e");
+    private final Guid volumeWithoutAsyncTask = new 
Guid("000000000000-0000-0000-0000-00000003");
+    private final Guid volumeWithoutRebalanceTask = new 
Guid("000000000000-0000-0000-0000-00000004");
+    private final Guid CLUSTER_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+
+    @ClassRule
+    public static MockConfigRule mcr = new MockConfigRule(
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
UNSUPPORTED_VERSION.getValue(), false),
+            mockConfig(ConfigValues.GlusterAsyncTasksSupport, 
SUPPORTED_VERSION.getValue(), true));
+
+    @Mock
+    protected VDSGroup vdsGroup;
 
     /**
      * The command under test.
@@ -82,6 +98,8 @@
         
doReturn(getvolumeWithoutRebalanceTask(volumeWithoutRebalanceTask)).when(volumeDao)
                 .getById(volumeWithoutRebalanceTask);
         doReturn(null).when(volumeDao).getById(null);
+        doReturn(SUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        doReturn(vdsGroup).when(command).getVdsGroup();
     }
 
     private Object getvolumeWithoutRebalanceTask(Guid volumeId) {
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
index d39fd3b..646d46f 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
@@ -64,6 +64,8 @@
         
doReturn(getVolumeWithoutRemoveBricksTask(volumeWithoutRemoveBricksTask)).when(volumeDao)
                 .getById(volumeWithoutRemoveBricksTask);
         doReturn(null).when(volumeDao).getById(null);
+        doReturn(SUPPORTED_VERSION).when(vdsGroup).getcompatibility_version();
+        doReturn(vdsGroup).when(command).getVdsGroup();
     }
 
     private Object getVolumeWithRemoveBricksTaskCompleted(Guid volumeId) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 94aca6c..d4727c0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -928,6 +928,7 @@
     ACTION_TYPE_FAILED_NO_SERVERS_FOR_CLUSTER(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_VOLUME_OPERATION_IN_PROGRESS(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS(ErrorType.CONFLICT),
+    
GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL(ErrorType.INCOMPATIBLE_VERSION),
     // OpenStack Glance
     ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_IMAGE_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index bbffa8b..8277260 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1134,6 +1134,8 @@
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS= Cannot 
${action} ${type}. Rebalance is running on the volume ${volumeName} in cluster 
${vdsGroup}.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REMOVE_BRICK_IN_PROGRESS= Cannot 
${action} ${type}. Remove brick operation is running on the volume 
${volumeName} in cluster ${vdsGroup}.
 ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS=Cannot ${action} ${type}. 
Gluster operation is in progress in cluster. Please try again.
+GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL=Cannot ${action} ${type}. 
Gluster task management is not supported in compatibility version 
${compatibilityVersion}.
+
 ACTION_TYPE_FAILED_TAG_ID_REQUIRED=Cannot ${action} ${type}. Tag ID is 
required.
 
 ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values 
are out of range.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index b34e6aa..1ff7d33 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -3066,6 +3066,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Gluster operation is in 
progress in cluster. Please try again.")
     String ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Gluster task management is 
not supported in compatibility version ${compatibilityVersion}.")
+    String GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL();
+
     @DefaultStringValue("Cannot ${action} ${type}. All three values are needed 
in order to define QoS on each network directions.")
     String ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 65cf3f6..833f87f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -1103,6 +1103,8 @@
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS= Cannot 
${action} ${type}. Rebalance is running on the volume ${volumeName} in cluster 
${vdsGroup}.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REMOVE_BRICK_IN_PROGRESS= Cannot 
${action} ${type}. Remove brick operation is running on the volume 
${volumeName} in cluster ${vdsGroup}.
 ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS=Cannot ${action} ${type}. 
Gluster operation is in progress in cluster. Please try again.
+GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL=Cannot ${action} ${type}. 
Gluster task management is not supported in compatibility version 
${compatibilityVersion}.
+
 ACTION_TYPE_FAILED_TAG_ID_REQUIRED=Cannot ${action} ${type}. Tag ID is 
required.
 
 ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values 
are out of range.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70ee8230253b04141133ccb639e00531086fd5bd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5.2
Gerrit-Owner: Sahina Bose <sab...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to