From 38d73bdfc659dde4a2632da2da01c785b642c728 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Mon, 13 Feb 2012 16:33:32 +0530 Subject: glusterd: Fail volume 'modify' operations when rb is ongoing * add-brick, stop-volume, remove-brick are the operations that are explicitly 'failed' when attempted while replace-brick is in progress. * we attach the volume-id to the dst_brick volfile ensuring that the replace-brick operation holds 'claim' on it. Change-Id: If60b2af566ca940b2add600b473c99730e06ab47 BUG: 765470 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.com/2740 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 31 +++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 2f1c37f0e9f..c170972ce83 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1024,6 +1024,16 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr) goto out; } + if (glusterd_is_rb_ongoing (volinfo)) { + snprintf (msg, sizeof (msg), "Replace brick is in progress on " + "volume %s. Please retry after replace-brick " + "operation is committed or aborted", volname); + gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + *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); @@ -1050,17 +1060,6 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr) free_ptr = brick_list; } - /* Check whether any of the bricks given is the destination brick of the - replace brick running */ - - str_ret = glusterd_check_brick_rb_part (all_bricks, count, volinfo); - if (str_ret) { - gf_log (THIS->name, GF_LOG_ERROR, "%s", str_ret); - *op_errstr = gf_strdup (str_ret); - ret = -1; - goto out; - } - if (count) brick = strtok_r (brick_list+1, " \n", &saveptr); @@ -1161,6 +1160,16 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) goto out; } + if (glusterd_is_rb_ongoing (volinfo)) { + snprintf (msg, sizeof (msg), "Replace brick is in progress on " + "volume %s. Please retry after replace-brick " + "operation is committed or aborted", volname); + gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + *op_errstr = gf_strdup (msg); + ret = -1; + goto out; + } + ret = dict_get_int32 (dict, "command", &flag); if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to get brick count"); -- cgit