summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-11-23 17:00:07 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-11-23 23:40:53 -0800
commit974837c3da9deb45cd2dc31afe56e5960268cf01 (patch)
treef865d9aa710159ce81e5abcb4a368e7c18171eff /cli
parent99657b970855d9735a195e8ac19c8f1011d0d713 (diff)
glusterd/bitrot : Integration of bad files from bitd with scrub status command
This patch is backport of: http://review.gluster.org/#/c/12720/ 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 <ggarg@redhat.com> Change-Id: If09babafaf5d7cf158fa79119abbf5b986027748 BUG: 1283881 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/12725 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c23
-rw-r--r--cli/src/cli-rpc-ops.c13
2 files changed, 18 insertions, 18 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 94c9fddfe1f..1d4d6cf89c7 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -5185,23 +5185,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 "
@@ -5268,7 +5251,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 24ca507c904..20c8c1d30d4 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -10675,6 +10675,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,};
@@ -10683,6 +10684,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;
@@ -10808,6 +10810,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", "=========================================="
"===============");