From aa9b19e4b3329f446f0eb9b3a4ed0dbb9ebe4d09 Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Tue, 12 Aug 2014 04:14:21 +0530 Subject: glusterd/snapshot : Fail the snapshot create operation if geo-rep is running. As one of the recommandations for taking a snapshot is not to have an active geo-replication session, its better to display an error saying session is active when snapshot create command is issued. Change-Id: I94593dbd2659610e033ca316176dda1ac8dc5ce6 BUG: 1129038 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/8461 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Atin Mukherjee Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index a86795e224e..09acb25c3f5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -1845,6 +1845,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr, loglevel = GF_LOG_WARNING; goto out; } + if (glusterd_is_defrag_on (volinfo)) { snprintf (err_str, sizeof (err_str), "rebalance process is running for the " @@ -1852,7 +1853,16 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr, loglevel = GF_LOG_WARNING; goto out; } - /* TODO: Also check whether geo replication is running */ + + if (gd_vol_is_geo_rep_active (volinfo)) { + snprintf (err_str, sizeof (err_str), + "geo-replication session is running for " + "the volume %s. Session needs to be " + "stopped before taking a snapshot.", + volname); + loglevel = GF_LOG_WARNING; + goto out; + } if (volinfo->is_snap_volume == _gf_true) { snprintf (err_str, sizeof (err_str), -- cgit