summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e5cf57514db..e3a9777c6c3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -681,6 +681,14 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req, char **op_errstr)
goto out;
}
+ if (glusterd_is_defrag_on(volinfo)) {
+ snprintf (msg, sizeof(msg), "Volume name %s rebalance is in "
+ "progress. Please retry after completion", volname);
+ gf_log ("glusterd", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+ ret = -1;
+ goto out;
+ }
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
gf_log ("", GF_LOG_ERROR, "Unable to get count");
@@ -844,6 +852,15 @@ glusterd_op_stage_replace_brick (gd1_mgmt_stage_op_req *req, char **op_errstr)
goto out;
}
+ if (glusterd_is_defrag_on(volinfo)) {
+ snprintf (msg, sizeof(msg), "Volume name %s rebalance is in "
+ "progress. Please retry after completion", volname);
+ gf_log ("glusterd", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_brickinfo_get (src_brick, volinfo,
&src_brickinfo);
if (ret) {
@@ -1310,6 +1327,27 @@ glusterd_op_stage_remove_brick (gd1_mgmt_stage_op_req *req)
goto out;
}
+ if (glusterd_is_defrag_on(volinfo)) {
+ ctx = glusterd_op_get_ctx (GD_OP_REMOVE_BRICK);
+ errstr = gf_strdup("Rebalance is in progress. Please retry"
+ " after completion");
+ if (!errstr) {
+ ret = -1;
+ goto out;
+ }
+ gf_log ("glusterd", GF_LOG_ERROR, "%s", errstr);
+ ret = dict_set_dynstr (ctx, "errstr", errstr);
+ if (ret) {
+ GF_FREE (errstr);
+ gf_log ("", GF_LOG_DEBUG,
+ "failed to set errstr ctx");
+ goto out;
+ }
+
+ ret = -1;
+ goto out;
+ }
+
if (volinfo->brick_count == 1) {
ctx = glusterd_op_get_ctx (GD_OP_REMOVE_BRICK);
if (!ctx) {
@@ -2851,7 +2889,6 @@ glusterd_op_remove_brick (gd1_mgmt_stage_op_req *req)
goto out;
}
-
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
gf_log ("", GF_LOG_ERROR, "Unable to get count");