From c553246c30290efcead1f32e4464ce86070ac9f2 Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Thu, 20 Mar 2014 17:11:17 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/7304 Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Rajesh Joseph Tested-by: Rajesh Joseph --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 0d9fa5617..0d322b9ad 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: -- cgit