summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-02-13 16:33:32 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-14 10:22:09 -0800
commit38d73bdfc659dde4a2632da2da01c785b642c728 (patch)
treeb51c6de6a886b4b53984727f39872dc640dbc820 /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent5f002b5418b557fd03ce59fbfd5d41272bdf491a (diff)
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 <kp@gluster.com> Reviewed-on: http://review.gluster.com/2740 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c31
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");