diff options
author | shishirng <shishirng@gluster.com> | 2012-03-06 18:55:37 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-07 21:14:27 -0800 |
commit | 33e9f9da8546dc57ecf6b3705f6b6474150ec78c (patch) | |
tree | 9455c2dcd9f49e7ff8b50fdcc3fb6d8b0534c975 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | f6a779ffc5b515163995dc2d240c3271cc6bceeb (diff) |
glusterd/rebalance: Bring in support for parallel rebalance
This patch, enables rebalance processes to be started on all
nodes where the volume is spread across (1 process per node)
node-uuid xattr identifies which node takes ownership of the
task to migrate the file. The model employed is push (src pushes
to dst)
Change-Id: Ieacd46a6216cf6ded841bbaebd10cfaea51c16d6
BUG: 763844
Signed-off-by: shishirng <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/2873
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-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 3c1baa7e62e..bda5e61e4fb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2709,6 +2709,83 @@ out: return ret; } + +int +glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict, + dict_t *op_ctx) +{ + int ret = 0; + char *volname = NULL; + glusterd_volinfo_t *volinfo = NULL; + uint64_t files = 0; + uint64_t size = 0; + uint64_t lookup = 0; + gf_defrag_status_t status = GF_DEFRAG_STATUS_NOT_STARTED; + + GF_ASSERT (req_dict); + + ret = dict_get_str (req_dict, "volname", &volname); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get volume name"); + goto out; + } + + ret = glusterd_volinfo_find (volname, &volinfo); + + if (ret) + goto out; + + ret = dict_get_uint64 (rsp_dict, "files", &files); + if (ret) + gf_log (THIS->name, GF_LOG_TRACE, + "failed to get file count"); + + ret = dict_get_uint64 (rsp_dict, "size", &size); + if (ret) + gf_log (THIS->name, GF_LOG_TRACE, + "failed to get size of xfer"); + + ret = dict_get_uint64 (rsp_dict, "lookups", &lookup); + if (ret) + gf_log (THIS->name, GF_LOG_TRACE, + "failed to get lookedup file count"); + ret = dict_get_int32 (rsp_dict, "status", (int32_t *)&status); + if (ret) + gf_log (THIS->name, GF_LOG_TRACE, + "failed to get status"); + + volinfo->rebalance_files += files; + volinfo->rebalance_data += size; + volinfo->lookedup_files += lookup; + + if (!op_ctx) { + dict_copy (rsp_dict, op_ctx); + goto out; + } + + ret = dict_set_uint64 (op_ctx, "files", volinfo->rebalance_files); + if (ret) + gf_log (THIS->name, GF_LOG_ERROR, + "failed to set file count"); + + ret = dict_set_uint64 (op_ctx, "size", volinfo->rebalance_data); + if (ret) + gf_log (THIS->name, GF_LOG_ERROR, + "failed to set size of xfer"); + + ret = dict_set_uint64 (op_ctx, "lookups", volinfo->lookedup_files); + if (ret) + gf_log (THIS->name, GF_LOG_ERROR, + "failed to set lookedup file count"); + ret = dict_set_int32 (op_ctx, "status", status); + if (ret) + gf_log (THIS->name, GF_LOG_ERROR, + "failed to set status"); + +out: + return ret; +} + int32_t glusterd_handle_node_rsp (glusterd_req_ctx_t *req_ctx, void *pending_entry, glusterd_op_t op, dict_t *rsp_dict, dict_t *op_ctx, @@ -2732,8 +2809,9 @@ glusterd_handle_node_rsp (glusterd_req_ctx_t *req_ctx, void *pending_entry, break; case GD_OP_DEFRAG_BRICK_VOLUME: - dict_copy (rsp_dict, op_ctx); - break; + glusterd_defrag_volume_node_rsp (req_ctx->dict, + rsp_dict, op_ctx); + break; case GD_OP_HEAL_VOLUME: ret = glusterd_heal_volume_brick_rsp (req_ctx->dict, rsp_dict, |