summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-10-30 15:56:14 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-11-17 01:26:52 -0800
commit60a4288f0a2444821e17ac6eaeb402b466dd4a1a (patch)
treee6a55e3921fb70a4735e95f09175072fe4060639 /cli
parent133bc60c9b93245a51900d0e46bf19cc7916f2dc (diff)
mgmt/glusterd: Store arbiter-count and restore it
Backport of http://review.gluster.com/12475 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> BUG: 1276907 Change-Id: I95c9857d645e02831892092bdd07539cc1a58270 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/12479 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.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 bafcfc835aa..75e5ad49640 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -584,14 +584,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);
@@ -603,9 +611,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);
+ }
}
}
@@ -698,7 +713,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)
@@ -716,7 +731,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);
@@ -742,6 +757,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;
@@ -905,6 +921,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)
@@ -962,7 +983,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":