From b94999ba8566bbf91cb9b402d2376f1ac9e36242 Mon Sep 17 00:00:00 2001 From: JulesWang Date: Fri, 21 Dec 2012 14:32:35 +0800 Subject: glusterd: "volume status" for remote brick fails on cli. cli fails because key "brick-index-max" is missing in rsp dict. Change-Id: I38119bbd31b68fe3ad1152af2495dff7624d99b7 BUG: 888752 Signed-off-by: JulesWang Reviewed-on: http://review.gluster.org/4347 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 4d2d5f8ab85..846deed643a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6568,6 +6568,7 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict) int32_t node_count = 0; int32_t rsp_node_count = 0; int32_t brick_index_max = -1; + int32_t rsp_brick_index_max = -1; int32_t other_count = 0; int32_t rsp_other_count = 0; dict_t *ctx_dict = NULL; @@ -6581,6 +6582,14 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict) goto out; } + ret = dict_get_int32 (rsp_dict, "brick-index-max", + &rsp_brick_index_max); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to get brick index max from rsp_dict"); + goto out; + } + ret = dict_get_int32 (rsp_dict, "other-count", &rsp_other_count); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, @@ -6600,6 +6609,17 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict) ret = dict_get_int32 (ctx_dict, "count", &node_count); ret = dict_get_int32 (ctx_dict, "brick-index-max", &brick_index_max); + if (ret) { + //This happens when flag GF_CLI_STATUS_BRICK is on + brick_index_max = rsp_brick_index_max; + ret = dict_set_int32 (ctx_dict, "brick-index-max", + rsp_brick_index_max); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to update brick index max"); + goto out; + } + } ret = dict_get_int32 (ctx_dict, "other-count", &other_count); rsp_ctx.count = node_count; -- cgit