summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-10-30 15:56:14 +0530
committerJeff Darcy <jdarcy@redhat.com>2015-11-04 13:39:32 -0800
commit1918d618a91fe9d9021916d53091173f4ad6b882 (patch)
tree9bbb201c7c212957d6770dceb699f2c3a9385396 /cli
parentdab82c7ba3901cfdf94db0cd69a46ea396cf920a (diff)
mgmt/glusterd: Store arbiter-count and restore it
Problem: 1) Glusterd doesn't remember about arbiter information of replica volume in store. When glusterd goes down and comes backup, arbiter volumes will become replica volumes. 2) Glusterd doesn't import/export arbiter information to/from the other peers. 3) Volume info doesn't show any arbiter count in the output. Fix: 1) Persist arbiter information in glusterd-store 2) Import/Export arbiter information of the volume 3) Change volume info output to show arbiter count. Change-Id: I2db81e73d2694b01f7d07b08a17b41ad5a55c361 BUG: 1276675 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/12475 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 41efde80312..45fbb93867d 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -579,14 +579,22 @@ out:
void
gf_cli_print_number_of_bricks (int type, int brick_count, int dist_count,
int stripe_count, int replica_count,
- int disperse_count, int redundancy_count)
+ int disperse_count, int redundancy_count,
+ int arbiter_count)
{
if (type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) {
- cli_out ("Number of Bricks: %d x %d x %d = %d",
- (brick_count / dist_count),
- stripe_count,
- replica_count,
- brick_count);
+ if (arbiter_count == 0) {
+ cli_out ("Number of Bricks: %d x %d x %d = %d",
+ (brick_count / dist_count),
+ stripe_count,
+ replica_count,
+ brick_count);
+ } else {
+ cli_out ("Number of Bricks: %d x %d x (%d + %d) = %d",
+ (brick_count / dist_count),
+ stripe_count, replica_count - arbiter_count,
+ arbiter_count, brick_count);
+ }
} else if (type == GF_CLUSTER_TYPE_NONE ||
type == GF_CLUSTER_TYPE_TIER) {
cli_out ("Number of Bricks: %d", brick_count);
@@ -598,9 +606,16 @@ gf_cli_print_number_of_bricks (int type, int brick_count, int dist_count,
} else {
/* For both replicate and stripe, dist_count is
good enough */
- cli_out ("Number of Bricks: %d x %d = %d",
- (brick_count / dist_count),
- dist_count, brick_count);
+ if (arbiter_count == 0) {
+ cli_out ("Number of Bricks: %d x %d = %d",
+ (brick_count / dist_count),
+ dist_count, brick_count);
+ } else {
+ cli_out ("Number of Bricks: %d x (%d + %d) = %d",
+ (brick_count / dist_count),
+ dist_count - arbiter_count, arbiter_count,
+ brick_count);
+ }
}
}
@@ -693,7 +708,7 @@ gf_cli_print_tier_info (dict_t *dict, int i, int brick_count)
cli_vol_type_str[vol_type]);
gf_cli_print_number_of_bricks (hot_type,
hot_brick_count, hot_dist_count, 0,
- hot_replica_count, 0, 0);
+ hot_replica_count, 0, 0, 0);
ret = print_brick_details (dict, i, 1, hot_brick_count);
if (ret)
@@ -711,7 +726,7 @@ 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);
+ cold_disperse_count, cold_redundancy_count, 0);
ret = print_brick_details (dict, i, hot_brick_count+1,
brick_count);
@@ -737,6 +752,7 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
int32_t replica_count = 0;
int32_t disperse_count = 0;
int32_t redundancy_count = 0;
+ int32_t arbiter_count = 0;
int32_t vol_type = 0;
int32_t transport = 0;
char *volume_id_str = NULL;
@@ -900,6 +916,11 @@ xml_output:
if (ret)
goto out;
+ snprintf (key, sizeof(key), "volume%d.arbiter_count", i);
+ ret = dict_get_int32 (dict, key, &arbiter_count);
+ if (ret)
+ goto out;
+
snprintf (key, 256, "volume%d.transport", i);
ret = dict_get_int32 (dict, key, &transport);
if (ret)
@@ -957,7 +978,8 @@ next:
#endif
gf_cli_print_number_of_bricks (type, brick_count,
dist_count, stripe_count, replica_count,
- disperse_count, redundancy_count);
+ disperse_count, redundancy_count,
+ arbiter_count);
cli_out ("Transport-type: %s",
((transport == 0)?"tcp":