diff options
author | Amar Tumballi <amar@gluster.com> | 2011-09-15 12:57:44 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-23 06:48:32 -0700 |
commit | 76580479033087f6dde080c27618baf19b18b658 (patch) | |
tree | 89a6b37046df9dc859e7f8ac7acd3f9115c69c2f /cli | |
parent | 1b096c3ff0a4c25ff22a32d9594d2e289a3d67ea (diff) |
glusterd: cleanup of volinfo '*_count' definitionsv3.3.0qa11
earlier, sub_count was having different meaning depending on the
volume type.
now, for replica and stripe count, one can directly access the
'replica_count' or 'stripe_count' to get the corresponding
value from the volume info. 'sub_count' is preserved as is for backward
compatibility. there is a new variable 'dist_leaf_count' to get
info about how many bricks are present in one distribute sub volume.
Change-Id: I5ea1c8f9ae08f584cca63b91ba69035c7e4350ca
BUG: 3158
Reviewed-on: http://review.gluster.com/435
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 78d27b624..b58e03173 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -381,8 +381,9 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, int32_t status = 0; int32_t type = 0; int32_t brick_count = 0; - int32_t sub_count = 0; + int32_t dist_count = 0; int32_t stripe_count = 0; + int32_t replica_count = 0; int32_t vol_type = 0; char *brick = NULL; int32_t j = 1; @@ -482,8 +483,8 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, if (ret) goto out; - snprintf (key, 256, "volume%d.sub_count", i); - ret = dict_get_int32 (dict, key, &sub_count); + snprintf (key, 256, "volume%d.dist_count", i); + ret = dict_get_int32 (dict, key, &dist_count); if (ret) goto out; @@ -492,6 +493,11 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, if (ret) goto out; + snprintf (key, 256, "volume%d.replica_count", i); + ret = dict_get_int32 (dict, key, &replica_count); + if (ret) + goto out; + snprintf (key, 256, "volume%d.transport", i); ret = dict_get_int32 (dict, key, &transport); if (ret) @@ -500,31 +506,30 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, vol_type = type; // Distributed (stripe/replicate/raid01) setups - if ((type > 0) && ( sub_count < brick_count)) + if ((type > 0) && ( dist_count < brick_count)) vol_type = type + 3; cli_out ("Volume Name: %s", volname); cli_out ("Type: %s", cli_volume_type[vol_type]); cli_out ("Status: %s", cli_volume_status[status]); - if ((sub_count > 1) && (brick_count > sub_count)) { - if (!stripe_count) - cli_out ("Number of Bricks: %d x %d = %d", - brick_count / sub_count, sub_count, - brick_count); - else - cli_out ("Number of Bricks: %d x %d x %d = %d", - brick_count / sub_count, stripe_count, - sub_count / stripe_count, brick_count); - } else { - if (!stripe_count) - cli_out ("Number of Bricks: %d", - brick_count); - else - cli_out ("Number of Bricks: %d x %d = %d", - stripe_count, - (brick_count / stripe_count), - brick_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); + else if (type == GF_CLUSTER_TYPE_NONE) + cli_out ("Number of Bricks: %d", + brick_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); + cli_out ("Transport-type: %s", ((transport == 0)?"tcp": |