Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: Added canDoAction for volume snapshot create and 
restore
......................................................................

gluster: Added canDoAction for volume snapshot create and restore

Added canDoAction conditions for gluster volume snapshot
create and restore commands.

Change-Id: I54f85ecae08e465e7d762e4772c5402d08ab14ea
Bug-Url: https://bugzilla.redhat.com/1215878
Bug-Url: https://bugzilla.redhat.com/1215884
Signed-off-by: Shubhendu Tripathi <shtri...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RestoreGlusterVolumeSnapshotCommand.java
2 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/41089/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
index 7f9f513..1a36bc7 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
@@ -11,6 +11,7 @@
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import 
org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeSnapshotParameters;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
+import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
@@ -196,6 +197,12 @@
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN);
         }
 
+        if (volume.getAsyncTask() != null
+                && (volume.getAsyncTask().getType() == 
GlusterTaskType.REBALANCE
+                || volume.getAsyncTask().getType() == 
GlusterTaskType.REMOVE_BRICK)) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_OPERATION_IN_PROGRESS);
+        }
+
         if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) {
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED);
         }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RestoreGlusterVolumeSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RestoreGlusterVolumeSnapshotCommand.java
index 678c3d6..727555e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RestoreGlusterVolumeSnapshotCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RestoreGlusterVolumeSnapshotCommand.java
@@ -10,6 +10,7 @@
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeSnapshotActionParameters;
+import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
@@ -292,6 +293,13 @@
             return false;
         }
 
+        GlusterVolumeEntity volume = getGlusterVolume();
+        if (volume.getAsyncTask() != null
+                && (volume.getAsyncTask().getType() == 
GlusterTaskType.REBALANCE
+                || volume.getAsyncTask().getType() == 
GlusterTaskType.REMOVE_BRICK)) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_OPERATION_IN_PROGRESS);
+        }
+
         for (GlusterGeoRepSession session : georepSessions) {
             if (session.getSlaveVolumeId() == null || 
session.getSlaveNodeUuid() == null) {
                 return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54f85ecae08e465e7d762e4772c5402d08ab14ea
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to