From aabbb0a1c1f65b34d05ce5e2a49ecc5c1c5e738f Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Mon, 18 Jan 2016 12:19:35 +0530 Subject: cli: Add arbiter details to volinfo xml output Backport of http://review.gluster.org/13229 The followig are added: 1. "1" and "1" 2. "0" on the brick info, like so: 127.0.0.2:/home/ravi/bricks/brick1 127.0.0.2:/home/ravi/bricks/brick1 cafa8612-d7d4-4007-beea-72ae7477f3bb 0 Also fix a bug in gluster vol info where the abiter brick was shown the wrong brick of the cold tier after performing a tier-attach. Change-Id: Id978325d02b04f1a08856427827320e169169810 BUG: 1300174 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/13263 Smoke: Gluster Build System Reviewed-by: Anuradha Talur NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- cli/src/cli-rpc-ops.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'cli/src/cli-rpc-ops.c') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index b7e0aedbcbb..aeddd636ed3 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -552,10 +552,11 @@ out: static int print_brick_details (dict_t *dict, int volcount, int start_index, - int end_index, int replica_count, int arbiter_count) + int end_index, int replica_count) { char key[1024] = {0,}; int index = start_index; + int isArbiter = 0; int ret = -1; char *brick = NULL; #ifdef HAVE_BD_XLATOR @@ -563,12 +564,20 @@ print_brick_details (dict_t *dict, int volcount, int start_index, #endif while (index <= end_index) { + memset (key, 0, sizeof (key)); snprintf (key, 1024, "volume%d.brick%d", volcount, index); ret = dict_get_str (dict, key, &brick); if (ret) goto out; + memset (key, 0, sizeof(key)); + snprintf (key, sizeof (key), "volume%d.brick%d.isArbiter", + volcount, index); + if (dict_get (dict, key)) + isArbiter = 1; + else + isArbiter = 0; - if (arbiter_count && index % replica_count == 0) + if (isArbiter) cli_out ("Brick%d: %s (arbiter)", index, brick); else cli_out ("Brick%d: %s", index, brick); @@ -726,7 +735,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) hot_replica_count, 0, 0, 0); ret = print_brick_details (dict, i, 1, hot_brick_count, - hot_replica_count, 0); + hot_replica_count); if (ret) goto out; @@ -745,8 +754,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) cold_disperse_count, cold_redundancy_count, cold_arbiter_count); ret = print_brick_details (dict, i, hot_brick_count+1, - brick_count, cold_replica_count, - cold_arbiter_count); + brick_count, cold_replica_count); if (ret) goto out; out: @@ -1015,7 +1023,7 @@ next: } else { cli_out ("Bricks:"); ret = print_brick_details (dict, i, j, brick_count, - replica_count, arbiter_count); + replica_count); if (ret) goto out; } -- cgit