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-03 22:45:43 -0700
commitd67d30e63f11d926ca8e46ea208758703566a76f (patch)
treea46f59bce463871a2177dc1f2f88fa5e56230719 /cli
parent9abed2198f78e476fff2c8cca3307915852043fe (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> Change-Id: I958bcae4eebca6bdf7b80866e2c40d3428ef78a4 BUG: 1332072 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/14142 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Venky Shankar <vshankar@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 1d507f7a205..d836f8e6aee 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -10804,9 +10804,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;
@@ -10864,9 +10864,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;
@@ -10878,6 +10878,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)
@@ -10889,6 +10916,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) {