From 097e131481d25e5b1f859f4ea556b8bf56155472 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Wed, 25 Mar 2015 18:07:24 +0530 Subject: glusterd: cli command implementation for bitrot scrub status CLI command for bitrot scrub status will be : gluster volume bitrot scrub status Above command will show the statistics of bitrot scrubber. Upon execution of this command it will show some common scrubber tunable value of volume followed by statistics of scrubber statistics of individual nodes. sample ouput for single node: Volume name : State of scrub: Active Scrub frequency: biweekly Bitrot error log location: /var/log/glusterfs/bitd.log Scrubber error log location: /var/log/glusterfs/scrub.log ========================================================= Node name: Number of Scrubbed files: Number of Unsigned files: Last completed scrub time: Duration of last scrub: Error count: ========================================================= This is just infrastructure. list of bad file, last scrub time, error count value will be taken care by http://review.gluster.org/#/c/12503/ and http://review.gluster.org/#/c/12654/ patches. Change-Id: I3ed3c7057c9d0c894233f4079a7f185d90c202d1 BUG: 1207627 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/10231 Reviewed-by: Atin Mukherjee Tested-by: NetBSD Build System Tested-by: Gluster Build System --- xlators/features/bit-rot/src/bitd/bit-rot.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'xlators/features/bit-rot/src/bitd') diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index d6ae5e2fdd2..c4ed7dee718 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1550,9 +1550,12 @@ int notify (xlator_t *this, int32_t event, void *data, ...) { int idx = -1; + int ret = -1; xlator_t *subvol = NULL; br_child_t *child = NULL; br_private_t *priv = NULL; + dict_t *output = NULL; + va_list ap; subvol = (xlator_t *)data; priv = this->private; @@ -1619,6 +1622,21 @@ notify (xlator_t *this, int32_t event, void *data, ...) default_notify (this, event, data); break; + case GF_EVENT_SCRUB_STATUS: + gf_log (this->name, GF_LOG_INFO, "BitRot scrub status " + "called"); + va_start (ap, data); + output = va_arg (ap, dict_t *); + + /* As of now hardcoding last-scrub-time value. At the time of + * Final patch submission this option value along with other + * few option value will be calculate based on real time */ + ret = dict_set_uint64 (output, "last-scrub-time", 12); + if (ret) { + gf_log (this->name, GF_LOG_DEBUG, "Failed to set last " + "scrub time value"); + } + break; default: default_notify (this, event, data); } -- cgit