diff options
author | shishir gowda <shishirng@gluster.com> | 2012-04-11 15:30:22 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-04-13 00:46:59 -0700 |
commit | bada6aeb2cabd12a11b0fe17bb01e9f2045b013d (patch) | |
tree | 52482d74a792309afd753e0942e561cb0e8eb8bf /xlators/mgmt/glusterd | |
parent | d80846bee0621f591a7b519743e4d91a620ccdca (diff) |
glusterd/remove-brick: Replace ABORT with STOP
Remove-brick stop now invokes rebalance stop. This leads
to a graceful stop of decommissioning.
The volfile is also updated (removal of decommission)
Change-Id: I5a8f725c0f54439b810ce32d988c21c02229c703
BUG: 811513
Signed-off-by: shishir gowda <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/3126
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 19 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 36 |
2 files changed, 39 insertions, 16 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 24ddc02ac0f..9754049073b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1256,7 +1256,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) break; } - case GF_OP_CMD_ABORT: + case GF_OP_CMD_STOP: + ret = 0; break; case GF_OP_CMD_COMMIT: @@ -1459,9 +1460,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) int32_t replica_count = 0; glusterd_brickinfo_t *brickinfo = NULL; glusterd_brickinfo_t *tmp = NULL; - glusterd_conf_t *priv = NULL; - char pidfile[PATH_MAX]; - ret = dict_get_str (dict, "volname", &volname); @@ -1492,19 +1490,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = 0; goto out; - case GF_OP_CMD_ABORT: + case GF_OP_CMD_STOP: { - if (volinfo->decommission_in_progress) { - priv = THIS->private; - if (!priv) - return ret; - - GLUSTERD_GET_DEFRAG_PID_FILE(pidfile, volinfo, priv); - - glusterd_service_stop ("rebalance", pidfile, SIGTERM, 1); - - } - /* Fall back to the old volume file */ list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) { diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index e8e75c24077..e3c4c47411f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -41,6 +41,7 @@ #include "glusterd-utils.h" #include "glusterd-store.h" #include "run.h" +#include "glusterd-volgen.h" #include "syscall.h" #include "cli1-xdr.h" @@ -596,6 +597,9 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict) char msg[2048] = {0}; glusterd_volinfo_t *volinfo = NULL; glusterd_conf_t *priv = NULL; + glusterd_brickinfo_t *brickinfo = NULL; + glusterd_brickinfo_t *tmp = NULL; + gf_boolean_t volfile_update = _gf_false; priv = THIS->private; @@ -626,6 +630,38 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict) cmd, NULL); break; case GF_DEFRAG_CMD_STOP: + /* Fall back to the old volume file in case of decommission*/ + list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, + brick_list) { + if (!brickinfo->decommissioned) + continue; + brickinfo->decommissioned = 0; + volfile_update = _gf_true; + } + + if (volfile_update == _gf_false) { + ret = 0; + break; + } + + ret = glusterd_create_volfiles_and_notify_services (volinfo); + if (ret) { + gf_log (THIS->name, GF_LOG_WARNING, + "failed to create volfiles"); + goto out; + } + + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); + if (ret) { + gf_log (THIS->name, GF_LOG_WARNING, + "failed to store volinfo"); + goto out; + } + + ret = 0; + break; + case GF_DEFRAG_CMD_STATUS: break; default: |