diff options
author | Kotresh HR <khiremat@redhat.com> | 2016-07-04 17:25:57 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-18 03:53:50 -0700 |
commit | 24310c41a6ce7a218dca8ca8545ba4d82834497f (patch) | |
tree | c813f81cd9a2e8f3e35f58d4e47ad02d18e4a8a3 /cli/src | |
parent | c80ec19ebf31053e675c20e7a00f8c40e28575f8 (diff) |
feature/bitrot: Show whether scrub is in progress/idle
Backport of http://review.gluster.org/14864/
Bitrot scrub status shows whether the scrub is paused
or active. It doesn't show whether the scrubber is
actually scrubbing or waiting in the timer wheel
for the next schedule. This patch shows this status
with "In Progress" and "Idle" respectively.
Change-Id: I995d8553d1ff166503ae1e7b46282fc3ba961f0b
BUG: 1355639
Signed-off-by: Kotresh HR <khiremat@redhat.com>
(cherry picked from commit f4757d256e3e00132ef204c01ed61f78f705ad6b)
Reviewed-on: http://review.gluster.org/14901
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index d5d98542203..72b77852acb 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -10942,6 +10942,8 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) uint64_t seconds = 0; char *last_scrub = NULL; uint64_t error_count = 0; + int8_t scrub_running = 0; + char *scrub_state_op = NULL; ret = dict_get_str (dict, "volname", &volname); @@ -10978,9 +10980,25 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) goto out; } + for (i = 1; i <= count; i++) { + memset (key, 0, 256); + snprintf (key, 256, "scrub-running-%d", i); + ret = dict_get_int8 (dict, key, &scrub_running); + if (ret) + gf_log ("cli", GF_LOG_TRACE, "failed to get scrubbed " + "files"); + if (scrub_running) + break; + } + + if (scrub_running) + gf_asprintf (&scrub_state_op, "%s (In Progress)", state_scrub); + else + gf_asprintf (&scrub_state_op, "%s (Idle)", state_scrub); + cli_out ("\n%s: %s\n", "Volume name ", volname); - cli_out ("%s: %s\n", "State of scrub", state_scrub); + cli_out ("%s: %s\n", "State of scrub", scrub_state_op); cli_out ("%s: %s\n", "Scrub impact", scrub_impact); @@ -11090,6 +11108,7 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) "==============="); out: + GF_FREE (scrub_state_op); return 0; } |