summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-04-20 17:53:50 +0530
committerVenky Shankar <vshankar@redhat.com>2016-05-19 23:21:22 -0700
commit9c7c83d7ac285a92607038321a51137ff3879c93 (patch)
tree87c631ea8bc1e57d3240d27b2b858cc138c6e93f /cli
parent911e85a54d0355df3d28be63cc4793d904da17fa (diff)
cli/bitrot: Unmask scrub statistics
Revert the commit 2a37dbd845348a774f45c4d77cffebc32c749251 The scrub statistics were masked because of inaccurate stats. Now with http://review.gluster.org/#/c/14044/ it's fixed, hence unmasking it. >Change-Id: Iffff5f48eb8121b617af82ecfb70bec5b2772c23 >BUG: 1329211 >Signed-off-by: Kotresh HR <khiremat@redhat.com> >Reviewed-on: http://review.gluster.org/14121 >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Venky Shankar <vshankar@redhat.com> >Reviewed-by: Atin Mukherjee <amukherj@redhat.com> >Signed-off-by: Kotresh HR <khiremat@redhat.com> BUG: 1332839 Change-Id: Icbdfd28eb9de5a149432c0aac1be4966c6b0fb06 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/14203 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c61
1 files changed, 55 insertions, 6 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 5476b05ac47..360e4eb3a18 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -10892,9 +10892,9 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict)
uint64_t unsigned_files = 0;
uint64_t scrub_time = 0;
uint64_t days = 0;
- uint64_t hour = 0;
- uint64_t minut = 0;
- uint64_t second = 0;
+ uint64_t hours = 0;
+ uint64_t minutes = 0;
+ uint64_t seconds = 0;
char *last_scrub = NULL;
uint64_t error_count = 0;
@@ -10952,9 +10952,9 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict)
last_scrub = NULL;
scrub_time = 0;
days = 0;
- hour = 0;
- minut = 0;
- second = 0;
+ hours = 0;
+ minutes = 0;
+ seconds = 0;
error_count = 0;
scrub_files = 0;
unsigned_files = 0;
@@ -10966,6 +10966,33 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict)
gf_log ("cli", GF_LOG_TRACE, "failed to get node-name");
memset (key, 0, 256);
+ snprintf (key, 256, "scrubbed-files-%d", i);
+ ret = dict_get_uint64 (dict, key, &scrub_files);
+ if (ret)
+ gf_log ("cli", GF_LOG_TRACE, "failed to get scrubbed "
+ "files");
+
+ memset (key, 0, 256);
+ snprintf (key, 256, "unsigned-files-%d", i);
+ ret = dict_get_uint64 (dict, key, &unsigned_files);
+ if (ret)
+ gf_log ("cli", GF_LOG_TRACE, "failed to get unsigned "
+ "files");
+
+ memset (key, 0, 256);
+ snprintf (key, 256, "scrub-duration-%d", i);
+ ret = dict_get_uint64 (dict, key, &scrub_time);
+ if (ret)
+ gf_log ("cli", GF_LOG_TRACE, "failed to get last scrub "
+ "duration");
+
+ memset (key, 0, 256);
+ snprintf (key, 256, "last-scrub-time-%d", i);
+ ret = dict_get_str (dict, key, &last_scrub);
+ if (ret)
+ gf_log ("cli", GF_LOG_TRACE, "failed to get last scrub"
+ " time");
+ memset (key, 0, 256);
snprintf (key, 256, "error-count-%d", i);
ret = dict_get_uint64 (dict, key, &error_count);
if (ret)
@@ -10977,6 +11004,28 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict)
cli_out ("%s: %s\n", "Node", node_name);
+ cli_out ("%s: %"PRIu64 "\n", "Number of Scrubbed files",
+ scrub_files);
+
+ cli_out ("%s: %"PRIu64 "\n", "Number of Skipped files",
+ unsigned_files);
+
+ if ((!last_scrub) || !strcmp (last_scrub, ""))
+ cli_out ("%s: %s\n", "Last completed scrub time",
+ "Scrubber pending to complete.");
+ else
+ cli_out ("%s: %s\n", "Last completed scrub time",
+ last_scrub);
+
+ /* Printing last scrub duration time in human readable form*/
+ seconds = scrub_time%60;
+ minutes = (scrub_time/60)%60;
+ hours = (scrub_time/3600)%24;
+ days = scrub_time/86400;
+ cli_out ("%s: %"PRIu64 ":%"PRIu64 ":%"PRIu64 ":%"PRIu64 "\n",
+ "Duration of last scrub (D:M:H:M:S)",
+ days, hours, minutes, seconds);
+
cli_out ("%s: %"PRIu64 "\n", "Error count", error_count);
if (error_count) {