From b81fc4a89b70336607e7734ca30e4152a415d237 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Mon, 24 Jul 2017 19:47:07 +0530 Subject: glusterd: highlight arbiter brick in get-state >Reviewed-on: https://review.gluster.org/17864 >Reviewed-by: Ravishankar N >Reviewed-by: Samikshan Bairagya >Reviewed-by: Shubhendu Tripathi >Smoke: Gluster Build System >CentOS-regression: Gluster Build System >(cherry picked from commit 555990188ae7fabd4ca36c07ddaa92a39dccc813) Fixes: #278 Change-Id: I1af5255127457a70e6362a2c20c53ee533e27c29 Signed-off-by: Atin Mukherjee Reviewed-on: https://review.gluster.org/17875 CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Shyamsundar Ranganathan --- xlators/mgmt/glusterd/src/glusterd-handler.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 3a6445d8ace..05587316246 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -5231,6 +5231,7 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) uint32_t get_state_cmd = 0; uint64_t memtotal = 0; uint64_t memfree = 0; + int start_index = 0; char *vol_type_str = NULL; char *hot_tier_type_str = NULL; @@ -5429,7 +5430,30 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) brickinfo->path); fprintf (fp, "Volume%d.Brick%d.hostname: %s\n", count_bkp, count, brickinfo->hostname); - + /* Determine which one is the arbiter brick */ + if (volinfo->arbiter_count == 1) { + if (volinfo->type == GF_CLUSTER_TYPE_TIER) { + if (volinfo->tier_info.cold_replica_count != 1) { + start_index = + volinfo->tier_info.hot_brick_count + 1; + if (count >= start_index && + ((count - start_index + 1) % + volinfo->tier_info.cold_replica_count == 0)) { + fprintf (fp, "Volume%d.Brick%d." + "is_arbiter: 1\n", + count_bkp, + count); + } + } + } else { + if (count % + volinfo->replica_count == 0) { + fprintf (fp, "Volume%d.Brick%d." + "is_arbiter: 1\n", + count_bkp, count); + } + } + } /* Add following information only for bricks * local to current node */ if (gf_uuid_compare (brickinfo->uuid, MY_UUID)) -- cgit