Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: Added canDoAction message for gluster volume deletion
......................................................................

gluster: Added canDoAction message for gluster volume deletion

Added a canDoAction check to not to allow gluster volume
deletion if it has snapshots associated with it.

Change-Id: I80f0bd8719cc90ff2f8ee478d830c1a1a67e4cdf
Bug-Url: https://bugzilla.redhat.com/1215876
Signed-off-by: Shubhendu Tripathi <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/DeleteGlusterVolumeCommand.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
5 files changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/40867/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/DeleteGlusterVolumeCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/DeleteGlusterVolumeCommand.java
index efbe9fb..936ed85 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/DeleteGlusterVolumeCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/DeleteGlusterVolumeCommand.java
@@ -45,6 +45,14 @@
             addCanDoActionMessageVariable("volumeName", volume.getName());
             return false;
         }
+
+        if (volume.getSnapshotsCount() > 0) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_SNAPSHOTS);
+            addCanDoActionMessageVariable("volumeName", volume.getName());
+            addCanDoActionMessageVariable("noOfSnapshots", 
volume.getSnapshotsCount());
+            return false;
+        }
+
         return true;
     }
 
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 fab63cf..2251393 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
@@ -899,6 +899,7 @@
     ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_UP(ErrorType.CONFLICT),
+    ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_SNAPSHOTS(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED(ErrorType.CONFLICT),
     
ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED(ErrorType.BAD_PARAMETERS),
     
ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_BRICK(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 d765e19..6ab21ac 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1085,6 +1085,7 @@
 VMPAYLOAD_FLOPPY_WITH_SYSPREP=Payload floppy deivce cannot be used with 
Sysprep via floppy device.
 VMPAYLOAD_CDROM_WITH_CLOUD_INIT=Payload cdrom deivce cannot be used with 
Cloud-Init via cdrom device.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_UP=Cannot ${action} ${type}. Gluster 
volume ${volumeName} is up.
+ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_SNAPSHOTS=Cannot ${action} ${type}. 
Gluster Volume ${volumeName} has ${noOfSnapshots} snapshots.\nTo delete the 
volume, first delete all the snapshots under it.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN=Cannot ${action} ${type}. Gluster 
Volume is down.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED=Cannot ${action} 
${type}. Gluster volume is not thinly provisioned.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAMS_IS_EMPTY=Cannot 
${action} ${type}. No gluster volume snapshot parameters for update.
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 e5e2362..ca0ea57 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
@@ -2889,6 +2889,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Gluster Volume 
${volumeName} is up.")
     String ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_UP();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Gluster Volume 
${volumeName} has ${noOfSnapshots} snapshots.\nTo delete the volume, first 
delete all the snapshots under it.")
+    String ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_SNAPSHOTS();
+
     @DefaultStringValue("Cannot ${action} ${type}. Gluster Volume is down.")
     String ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN();
 
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 2d6ed87..62deed7 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
@@ -1068,6 +1068,7 @@
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED=Cannot ${action} ${type}. 
Gluster Volume ${volumeName} already started.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED=Cannot ${action} ${type}. 
Gluster Volume ${volumeName} already stopped.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_UP=Cannot ${action} ${type}. Gluster 
Volume ${volumeName} is up.
+ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_SNAPSHOTS=Cannot ${action} ${type}. 
Gluster Volume ${volumeName} has ${noOfSnapshots} snapshots.\nTo delete the 
volume, first delete all the snapshots under it.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN=Cannot ${action} ${type}. Gluster 
Volume is down.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED=Cannot ${action} 
${type}. Gluster volume is not thinly provisioned.
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAMS_IS_EMPTY=Cannot 
${action} ${type}. No gluster volume snapshot parameters for update.


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

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

Reply via email to