diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-10-28 16:46:56 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-10-28 08:08:13 -0700 |
commit | 99e5f3af513446f382e80e3086398532ca914692 (patch) | |
tree | 815b578a12240304ea8fe9fad70d5321235bb0d7 /xlators/mgmt | |
parent | bca358604d6ee98f7aed43507eaea91ca9dba576 (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 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |