Selvasundaram has uploaded a new change for review.
Change subject: engine: gluster action version check added
......................................................................
engine: gluster action version check added
- Minimum Gluster supported version for an action is virtually
mapped with minimum cluster version.
Change-Id: I12047a40a4ef81901ce3050f1d39abe0af746d55
Signed-off-by: Selvasundaram <[email protected]>
---
A
backend/manager/dbscripts/upgrade/03_01_1540_add_gluster_action_version_map.sql
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterVolumeCommandBase.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopGlusterVolumeCommandTest.java
5 files changed, 69 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/9670/1
diff --git
a/backend/manager/dbscripts/upgrade/03_01_1540_add_gluster_action_version_map.sql
b/backend/manager/dbscripts/upgrade/03_01_1540_add_gluster_action_version_map.sql
new file mode 100644
index 0000000..90a0305
--- /dev/null
+++
b/backend/manager/dbscripts/upgrade/03_01_1540_add_gluster_action_version_map.sql
@@ -0,0 +1,53 @@
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1400, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1400);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1401, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1401);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1402, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1402);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1403, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1403);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1404, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1404);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1405, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1405);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1406, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1406);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1407, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1407);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1408, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1408);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1409, '3.1', '*'
+ where not exists (select 1 from action_version_map where action_type =
1409);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1410, '3.2', '*'
+ where not exists (select 1 from action_version_map where action_type =
1410);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1411, '3.2', '*'
+ where not exists (select 1 from action_version_map where action_type =
1411);
+
+insert into action_version_map (action_type, cluster_minimal_version,
storage_pool_minimal_version)
+ select 1412, '3.2', '*'
+ where not exists (select 1 from action_version_map where action_type =
1412);
+
+
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterVolumeCommandBase.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterVolumeCommandBase.java
index 62db91e..6e19a88 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterVolumeCommandBase.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterVolumeCommandBase.java
@@ -5,6 +5,7 @@
import org.ovirt.engine.core.bll.utils.PermissionSubject;
import org.ovirt.engine.core.common.VdcObjectType;
+import org.ovirt.engine.core.common.action.VdcReturnValueBase;
import org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters;
import
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
@@ -32,14 +33,24 @@
return DbFacade.getInstance().getGlusterOptionDao();
}
+ private void setClusterId() {
+ if (getGlusterVolume() != null) {
+ setVdsGroupId(getGlusterVolume().getClusterId());
+ }
+ }
+
+ @Override
+ public VdcReturnValueBase canDoActionOnly() {
+ setClusterId();
+ return super.canDoActionOnly();
+ }
+
@Override
protected boolean canDoAction() {
if (getGlusterVolume() == null) {
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID);
return false;
}
- setVdsGroupId(getGlusterVolume().getClusterId());
-
// super class canDoAction expects cluster id (VdsGroupId).
if (!super.canDoAction()) {
return false;
diff --git
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java
index d27d011..a6077e2 100644
---
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java
+++
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java
@@ -127,6 +127,7 @@
doReturn(getBricks(serverId)).when(brickDao).getGlusterVolumeBricksByServerId(serverId);
doReturn(null).when(volumeDao).getById(null);
doReturn(getVdsStatic()).when(vdsStaticDao).get(serverId);
+ doReturn(clusterId).when(command).getVdsGroupId();
}
private VdsStatic getVdsStatic() {
diff --git
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java
index b8089e6..e05c12c 100644
---
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java
+++
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java
@@ -60,6 +60,7 @@
doReturn(getReplicatedVolume(volumeId4,
4)).when(volumeDao).getById(volumeId4);
doReturn(null).when(volumeDao).getById(null);
doReturn(getVdsStatic()).when(vdsStaticDao).get(serverId);
+ doReturn(clusterId).when(command).getVdsGroupId();
}
private VDS getVds(VDSStatus status) {
diff --git
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopGlusterVolumeCommandTest.java
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopGlusterVolumeCommandTest.java
index c78ffb3..9d77510 100644
---
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopGlusterVolumeCommandTest.java
+++
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopGlusterVolumeCommandTest.java
@@ -13,8 +13,8 @@
import org.ovirt.engine.core.common.businessentities.VDS;
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.GlusterVolumeEntity;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
+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.compat.Guid;
--
To view, visit http://gerrit.ovirt.org/9670
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12047a40a4ef81901ce3050f1d39abe0af746d55
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Selvasundaram <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches