From 4348a6af89085cbdb41963f828b88deee4a109f1 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Mon, 23 Nov 2015 17:00:07 +0530 Subject: glusterd/bitrot : Integration of bad files from bitd with scrub status command Currently scrub status command is not displaying list of all the bad files. All the bad files are avaliable in the bitd daemon. With this patch it will dispaly list of all the bad file's in the scrub status command. Change-Id: If09babafaf5d7cf158fa79119abbf5b986027748 BUG: 1207627 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/12720 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-cmd-parser.c | 23 +++++------------------ cli/src/cli-rpc-ops.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index ef07e88b795..c72f99db194 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -5180,23 +5180,6 @@ 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 " @@ -5263,7 +5246,11 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) ret = -1; goto out; } else { - type = GF_BITROT_OPTION_TYPE_SCRUB; + if (strcmp (words[4], "status") == 0) { + type = GF_BITROT_CMD_SCRUB_STATUS; + } else { + type = GF_BITROT_OPTION_TYPE_SCRUB; + } ret = dict_set_str (dict, "scrub-value", (char *) words[4]); if (ret) { diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 27d0595bd3c..0365539fda5 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -10669,6 +10669,7 @@ int gf_cli_print_bitrot_scrub_status (dict_t *dict) { int i = 1; + int j = 0; int ret = -1; int count = 0; char key[256] = {0,}; @@ -10677,6 +10678,7 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) char *scrub_freq = NULL; char *state_scrub = NULL; char *scrub_impact = NULL; + char *bad_file_str = NULL; char *scrub_log_file = NULL; char *bitrot_log_file = NULL; uint64_t scrub_files = 0; @@ -10802,6 +10804,17 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) cli_out ("%s: %"PRIu64 "\n", "Error count", error_count); + if (error_count) + cli_out ("%s:\n", "Corrupted object's"); + /* Printing list of bad file's (Corrupted object's)*/ + for (j = 0; j < error_count; j++) { + memset (key, 0, 256); + snprintf (key, 256, "quarantine-%d-%d", j, i); + ret = dict_get_str (dict, key, &bad_file_str); + if (!ret) { + cli_out ("%s\n", bad_file_str); + } + } } cli_out ("%s\n", "==========================================" "==============="); -- cgit