summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-10-28 16:46:56 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-28 08:08:13 -0700
commit99e5f3af513446f382e80e3086398532ca914692 (patch)
tree815b578a12240304ea8fe9fad70d5321235bb0d7 /cli
parentbca358604d6ee98f7aed43507eaea91ca9dba576 (diff)
glusterd: Fixed volume profile's "are all bricks down?" algo.
"count" key is not set if no brick in the volume (located across peers) is running. Sending "count" even when zero bricks are running from originator glusterd to client, simplifies "are all bricks down?" algo. Change-Id: I3a8db48c4c61cd31ba96031638a3c3d26efd2887 BUG: 3553 Reviewed-on: http://review.gluster.com/641 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 7cf5929d87c..9b91637ddad 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -3109,6 +3109,12 @@ gf_cli3_1_profile_volume_cbk (struct rpc_req *req, struct iovec *iov,
ret = dict_get_int32 (dict, "count", &brick_count);
if (ret)
goto out;
+
+ if (!brick_count) {
+ cli_out ("All bricks of volume %s are down.", volname);
+ goto out;
+ }
+
while (i <= brick_count) {
snprintf (key, sizeof (key), "%d-cumulative", i);
ret = dict_get_int32 (dict, key, &interval);
@@ -3241,6 +3247,12 @@ gf_cli3_1_top_volume_cbk (struct rpc_req *req, struct iovec *iov,
ret = dict_get_int32 (dict, "count", &brick_count);
if (ret)
goto out;
+
+ if (!brick_count) {
+ cli_out ("All bricks of volume %s are down.");
+ goto out;
+ }
+
snprintf (key, sizeof (key), "%d-top-op", 1);
ret = dict_get_int32 (dict, key, (int32_t*)&top_op);
if (ret)