diff options
author | Sanju Rakonde <srakonde@redhat.com> | 2019-10-22 15:06:29 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-11-12 06:17:06 +0000 |
commit | 50b6806bb2697246bdc1b9ac5ef19af61584e010 (patch) | |
tree | 901a9aea32744edcdd31cf27eca3d14bb6ead8d3 /cli | |
parent | 5304eaa662b263791baf0e5a9bd616446a3919ef (diff) |
cli: display detailed rebalance info
Problem: When one of the node is down in cluster,
rebalance status is not displaying detailed
information.
Cause: In glusterd_volume_rebalance_use_rsp_dict()
we are aggregating rsp from all the nodes into a
dictionary and sending it to cli for printing. While
assigning a index to keys we are considering all the
peers instead of considering only the peers which are
up. Because of which, index is not reaching till 1.
while parsing the rsp cli unable to find status-1
key in dictionary and going out without printing
any information.
Solution: The simplest fix for this without much
code change is to continue to look for other keys
when status-1 key is not found.
fixes: bz#1764119
Change-Id: I0062839933c9706119eb85416256eade97e976dc
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6cd31d200b1..f3228448cb3 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1467,13 +1467,20 @@ gf_cli_print_rebalance_status(dict_t *dict, enum gf_task_types task_type) goto out; } - snprintf(key, sizeof(key), "status-1"); - - ret = dict_get_int32(dict, key, (int32_t *)&status_rcd); - if (ret) { - gf_log("cli", GF_LOG_TRACE, "count %d %d", count, 1); - gf_log("cli", GF_LOG_TRACE, "failed to get status"); - goto out; + for (i = 1; i <= count; i++) { + snprintf(key, sizeof(key), "status-%d", i); + ret = dict_get_int32(dict, key, (int32_t *)&status_rcd); + /* If information from a node is missing we should skip + * the node and try to fetch information of other nodes. + * If information is not found for all nodes, we should + * error out. + */ + if (!ret) + break; + if (ret && i == count) { + gf_log("cli", GF_LOG_TRACE, "failed to get status"); + goto out; + } } /* Fix layout will be sent to all nodes for the volume |