summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
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-19 22:31:36 -0800
commit67b7752eccd8eae6a91f3bc3ff55d65dcf858dc7 (patch)
tree0c28eb2bc9e2407a7ce72a225690d13ef2882916 /cli/src/cli-rpc-ops.c
parentc535059299785f7d050482c257f10389c218048b (diff)
cli: Add arbiter details to volinfo xml output
The following 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: 1297750 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13229 Smoke: Gluster Build System <jenkins@build.gluster.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 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 741fb42b83e..62a113a4dd8 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -547,10 +547,11 @@ out:
static int
print_brick_details (dict_t *dict, int volcount, int start_index,
- int end_index, int replica_count, int arbiter_count)
+ int end_index, int replica_count)
{
char key[1024] = {0,};
int index = start_index;
+ int isArbiter = 0;
int ret = -1;
char *brick = NULL;
#ifdef HAVE_BD_XLATOR
@@ -558,12 +559,20 @@ print_brick_details (dict_t *dict, int volcount, int start_index,
#endif
while (index <= end_index) {
+ memset (key, 0, sizeof (key));
snprintf (key, 1024, "volume%d.brick%d", volcount, index);
ret = dict_get_str (dict, key, &brick);
if (ret)
goto out;
+ memset (key, 0, sizeof(key));
+ snprintf (key, sizeof (key), "volume%d.brick%d.isArbiter",
+ volcount, index);
+ if (dict_get (dict, key))
+ isArbiter = 1;
+ else
+ isArbiter = 0;
- if (arbiter_count && index % replica_count == 0)
+ if (isArbiter)
cli_out ("Brick%d: %s (arbiter)", index, brick);
else
cli_out ("Brick%d: %s", index, brick);
@@ -721,7 +730,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count)
hot_replica_count, 0, 0, 0);
ret = print_brick_details (dict, i, 1, hot_brick_count,
- hot_replica_count, 0);
+ hot_replica_count);
if (ret)
goto out;
@@ -740,8 +749,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count)
cold_disperse_count, cold_redundancy_count, cold_arbiter_count);
ret = print_brick_details (dict, i, hot_brick_count+1,
- brick_count, cold_replica_count,
- cold_arbiter_count);
+ brick_count, cold_replica_count);
if (ret)
goto out;
out:
@@ -1010,7 +1018,7 @@ next:
} else {
cli_out ("Bricks:");
ret = print_brick_details (dict, i, j, brick_count,
- replica_count, arbiter_count);
+ replica_count);
if (ret)
goto out;
}