diff options
author | shishir gowda <shishirng@gluster.com> | 2010-09-30 03:41:04 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-30 06:57:59 -0700 |
commit | bf152d98cee31a2346f3aec32301ca4a4bbfcea1 (patch) | |
tree | 6ecc21800004d86b9e57d33bde1300ae82dc21fb /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | d39ed89765a8d0a1f767b864fd6826d29de7ad1f (diff) |
Block add, remove and replace brick ops when rebalance is in progress
Also fixing msg, changing defrag to rebalance
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 971 (dynamic volume management)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 39 |
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"); |