From 7ef5e08040ef11ff93f44ad3a394f6ea18b2e42b Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Mon, 24 Jul 2017 19:47:07 +0530 Subject: [PATCH 609/616] glusterd: highlight arbiter brick in get-state >Fixes: #278 >Change-Id: I1af5255127457a70e6362a2c20c53ee533e27c29 >Signed-off-by: Atin Mukherjee >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 Bug: 1475333 Change-Id: I1af5255127457a70e6362a2c20c53ee533e27c29 Signed-off-by: Atin Mukherjee Reviewed-on: https://code.engineering.redhat.com/gerrit/117170 --- xlators/mgmt/glusterd/src/glusterd-handler.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index c97d87d..bd17cd4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -5104,6 +5104,7 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) int odirlen = 0; time_t now = 0; char timestamp[16] = {0,}; + int start_index = 0; char *vol_type_str = NULL; char *hot_tier_type_str = NULL; @@ -5296,7 +5297,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)) -- 1.8.3.1