From 4ebd70ce34d4d3825f850f118933069b9ea2924f Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Wed, 25 Nov 2015 16:42:20 +0530 Subject: cli: Indicate which brick of the replica is the arbiter Backport of http://review.gluster.org/#/c/12747/ Enhances the cli output for arbiter volumes as requested in the BZ. Signed-off-by: Ravishankar N Change-Id: I28cc34d7d19def043d54291cede25a58dbcc5051 BUG: 1283570 Reviewed-on: http://review.gluster.org/12748 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Atin Mukherjee --- cli/src/cli-rpc-ops.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 20c8c1d30d4..2357369b474 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -552,7 +552,7 @@ out: static int print_brick_details (dict_t *dict, int volcount, int start_index, - int end_index) + int end_index, int replica_count, int arbiter_count) { char key[1024] = {0,}; int index = start_index; @@ -568,7 +568,10 @@ print_brick_details (dict_t *dict, int volcount, int start_index, if (ret) goto out; - cli_out ("Brick%d: %s", index, brick); + if (arbiter_count && index % replica_count == 0) + cli_out ("Brick%d: %s (arbiter)", index, brick); + else + cli_out ("Brick%d: %s", index, brick); #ifdef HAVE_BD_XLATOR snprintf (key, 1024, "volume%d.vg%d", volcount, index); ret = dict_get_str (dict, key, &caps); @@ -633,6 +636,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) int cold_type = 0; int cold_brick_count = 0; int cold_replica_count = 0; + int cold_arbiter_count = 0; int cold_disperse_count = 0; int cold_redundancy_count = 0; int cold_dist_count = 0; @@ -669,6 +673,12 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) if (ret) goto out; + memset (key, 0, sizeof (key)); + snprintf (key, 256, "volume%d.cold_arbiter_count", i); + ret = dict_get_int32 (dict, key, &cold_arbiter_count); + if (ret) + goto out; + memset (key, 0, sizeof (key)); snprintf (key, 256, "volume%d.cold_disperse_count", i); ret = dict_get_int32 (dict, key, &cold_disperse_count); @@ -715,7 +725,8 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) hot_brick_count, hot_dist_count, 0, hot_replica_count, 0, 0, 0); - ret = print_brick_details (dict, i, 1, hot_brick_count); + ret = print_brick_details (dict, i, 1, hot_brick_count, + hot_replica_count, 0); if (ret) goto out; @@ -731,10 +742,11 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count) gf_cli_print_number_of_bricks (cold_type, cold_brick_count, cold_dist_count, 0, cold_replica_count, - cold_disperse_count, cold_redundancy_count, 0); + cold_disperse_count, cold_redundancy_count, cold_arbiter_count); ret = print_brick_details (dict, i, hot_brick_count+1, - brick_count); + brick_count, cold_replica_count, + cold_arbiter_count); if (ret) goto out; out: @@ -1002,7 +1014,8 @@ next: } else { cli_out ("Bricks:"); - ret = print_brick_details (dict, i, j, brick_count); + ret = print_brick_details (dict, i, j, brick_count, + replica_count, arbiter_count); if (ret) goto out; } -- cgit