From 94d32434fdb1d7fc333ab9bf4bf8d3a4eb0dff9e Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Mon, 18 Apr 2011 08:49:54 +0000 Subject: mgmt/glusterd: do not allow replace-brick operations when geo-rep sessions are active on this volume. Signed-off-by: Kaushik BV Signed-off-by: Anand Avati BUG: 2765 (geo-replication should have mercy on brick failure) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2765 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 688fec152..70fddf205 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -838,6 +838,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, char *dup_dstbrick = NULL; glusterd_peerinfo_t *peerinfo = NULL; glusterd_brickinfo_t *dst_brickinfo = NULL; + gf_boolean_t is_run = _gf_false; ret = dict_get_str (dict, "src-brick", &src_brick); @@ -887,6 +888,23 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, goto out; } + ret = glusterd_check_gsync_running (volinfo, &is_run); + if (ret && (is_run == _gf_false)) + gf_log ("", GF_LOG_WARNING, "Unable to get the status" + " of active "GEOREP" session"); + if (is_run) { + gf_log ("", GF_LOG_WARNING, GEOREP" sessions active" + "for the volume %s ", volname); + snprintf (msg, sizeof(msg), GEOREP" sessions are active " + "for the volume %s.\nStop "GEOREP "sessions " + "involved in this volume. Use 'volume "GEOREP + " status' command for more info.", + volname); + *op_errstr = gf_strdup (msg); + ret = -1; + goto out; + } + if (glusterd_is_defrag_on(volinfo)) { snprintf (msg, sizeof(msg), "Volume name %s rebalance is in " "progress. Please retry after completion", volname); -- cgit