summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-rpc-ops.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c10
2 files changed, 21 insertions, 1 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)
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index dad6d513c74..2d8c6e75881 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -58,6 +58,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
char *free_ptr = NULL;
glusterd_conf_t *conf = NULL;
+ GF_ASSERT (op_ctx);
GF_ASSERT (THIS);
conf = THIS->private;
@@ -331,7 +332,8 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
}
case GD_OP_PROFILE_VOLUME:
{
- gf1_cli_stats_volume_rsp rsp = {0,};
+ gf1_cli_stats_volume_rsp rsp = {0,};
+ int32_t count = 0;
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
if (op_errstr)
@@ -339,6 +341,12 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
else
rsp.op_errstr = "";
ctx = op_ctx;
+ if (dict_get_int32 (ctx, "count", &count)) {
+ ret = dict_set_int32 (ctx, "count", 0);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_WARNING, "Failed "
+ "to set brick count.");
+ }
dict_allocate_and_serialize (ctx,
&rsp.stats_info.stats_info_val,
(size_t*)&rsp.stats_info.stats_info_len);