summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2015-11-25 16:42:20 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-11-25 23:27:58 -0800
commit4ebd70ce34d4d3825f850f118933069b9ea2924f (patch)
tree27c7269f8c7ad1ae89a9ac036ddeb634f1a7b5a7 /cli
parent27ff5e14e2577c671f5890ec845ec04e8046ec52 (diff)
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 <ravishankar@redhat.com> Change-Id: I28cc34d7d19def043d54291cede25a58dbcc5051 BUG: 1283570 Reviewed-on: http://review.gluster.org/12748 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 20c8c1d..2357369 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;
@@ -670,6 +674,12 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count)
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);
if (ret)
@@ -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;
}