diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 31 |
1 files changed, 20 insertions, 11 deletions
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"); |