summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-01-18 12:19:35 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-21 21:28:08 -0800
commitaabbb0a1c1f65b34d05ce5e2a49ecc5c1c5e738f (patch)
tree0feac91c85b1191d18ff4f0bc5e28e611d8f68a0 /xlators/mgmt
parent57ca7c831cd231f56502d0aa5a4d042a48f5894e (diff)
cli: Add arbiter details to volinfo xml output
Backport of http://review.gluster.org/13229 The followig are added: 1. "<arbiterCount>1</arbiterCount>" and "<coldarbiterCount>1</coldarbiterCount>" 2. "<isArbiter>0</isArbiter>" on the brick info, like so: <brick uuid="cafa8612-d7d4-4007-beea-72ae7477f3bb">127.0.0.2:/home/ravi/bricks/brick1 <name>127.0.0.2:/home/ravi/bricks/brick1</name> <hostUuid>cafa8612-d7d4-4007-beea-72ae7477f3bb</hostUuid> <isArbiter>0</isArbiter> </brick> 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 <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13263 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anuradha Talur <atalur@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 1e7affd51a1..0d9e60dba1c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -409,6 +409,53 @@ out:
}
int
+glusterd_add_arbiter_info_to_bricks (glusterd_volinfo_t *volinfo,
+ dict_t *volumes, int count)
+{
+ char key[256] = {0, };
+ int i = 0;
+ int start_index = 0;
+ int ret = 0;
+
+ if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
+ /*TODO: Add info for hot tier once attach tier of arbiter
+ * volumes is supported. */
+
+ /* cold tier */
+ if (volinfo->tier_info.cold_replica_count == 1 ||
+ volinfo->arbiter_count != 1)
+ return 0;
+
+ i = start_index = volinfo->tier_info.hot_brick_count + 1;
+ for (; i <= volinfo->brick_count; i++) {
+ if ((i - start_index + 1) %
+ volinfo->tier_info.cold_replica_count != 0)
+ continue;
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.brick%d.isArbiter",
+ count, i);
+ ret = dict_set_int32 (volumes, key, 1);
+ if (ret)
+ return ret;
+ }
+ } else {
+ if (volinfo->replica_count == 1 || volinfo->arbiter_count != 1)
+ return 0;
+ for (i = 1; i <= volinfo->brick_count; i++) {
+ if (i % volinfo->replica_count != 0)
+ continue;
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.brick%d.isArbiter",
+ count, i);
+ ret = dict_set_int32 (volumes, key, 1);
+ if (ret)
+ return ret;
+ }
+ }
+ return 0;
+}
+
+int
glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
dict_t *volumes, int count)
{
@@ -629,6 +676,9 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
#endif
i++;
}
+ ret = glusterd_add_arbiter_info_to_bricks (volinfo, volumes, count);
+ if (ret)
+ goto out;
dict = volinfo->dict;
if (!dict) {