From 164a8dda2cbf10862483e0333ebf7e727fc87f07 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Fri, 20 Nov 2015 14:00:38 +0530 Subject: glusterd: cli command implementation for bitrot scrub status This patch is backport of: http://review.gluster.org/10231 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 Change-Id: I45ed94e5e0e78a1e007c30eb0b252f74cf3c9187 BUG: 1283881 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/12704 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-cmd-parser.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index ab18aa1ae6d..cc0a9aba96c 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -5094,7 +5094,7 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) "biweekly", "monthly", NULL}; char *scrub_values[] = {"pause", "resume", - NULL}; + "status", NULL}; dict_t *dict = NULL; gf_bitrot_type type = GF_BITROT_OPTION_TYPE_NONE; int32_t expiry_time = 0; @@ -5158,6 +5158,23 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) } } + if ((strcmp (words[3], "scrub") == 0) && + (strcmp (words[4], "status") == 0)) { + if (wordcount == 5) { + type = GF_BITROT_CMD_SCRUB_STATUS; + ret = dict_set_str (dict, "scrub-value", + (char *) words[4]); + if (ret) { + cli_out ("Failed to set dict for scrub status"); + goto out; + } + goto set_type; + } else { + ret = -1; + goto out; + } + } + if (!strcmp (w, "scrub-throttle")) { if (!words[4]) { cli_err ("Missing scrub-throttle value for bitrot " -- cgit