summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2014-03-20 17:11:17 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-03-25 04:31:55 -0700
commitc553246c30290efcead1f32e4464ce86070ac9f2 (patch)
tree4919c6c3350c0e43c0d1f7d611dce08e80825752
parente078092e827807aec0eef185198771f49f809b34 (diff)
snapshot : Fix for not deleting volumes with snapshots
Error out when trying to delete volume with snapshots. Check the snap_count in glusterd_op_stage_delete_volume() Change-Id: I4f0d62cbb469bb75f39ea966274f56810fa89333 BUG: 1077655 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/7304 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 0d9fa56..0d322b9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1183,6 +1183,16 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ if (volinfo->snap_count > 0 || !list_empty(&volinfo->snap_volumes)) {
+ snprintf (msg, sizeof (msg), "Cannot delete Volume %s ,"
+ "as it has %ld snapshots. "
+ "To delete the volume, "
+ "first delete all the snapshots under it.",
+ volname, volinfo->snap_count);
+ ret = -1;
+ goto out;
+ }
+
ret = 0;
out: