summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-11-25 17:38:43 +0530
committerVenky Shankar <vshankar@redhat.com>2015-12-14 19:08:39 -0800
commit22827d51c232c44a8f5ac003529d907d93baf7b0 (patch)
tree6cd9965c9a87c4332b865a9d602927de62f165e6 /xlators/mgmt/glusterd/src/glusterd-utils.c
parent0598ca33ec95b4f4c44582c6154c52494b910b3a (diff)
bitrot: getting correct value of scrub stat's
When user execute bitrot scrub status command then gluster is not giving correct value of Number of Scrubbed files, Number of Unsigned files, Last completed scrub time, Duration of last scrub. With this patch scrub status will give correct value for all the above fields. Change-Id: Ic966f76d22db5b0c889e6386a1c2219afbda1f49 BUG: 1285989 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/12776 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index d24c3dff12d..a388ac113c8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -8326,7 +8326,8 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
uint64_t scrubbed_files = 0;
uint64_t unsigned_files = 0;
uint64_t scrub_duration = 0;
- uint64_t last_scrub_time = 0;
+ char *last_scrub_time = NULL;
+ char *scrub_time = NULL;
char *volname = NULL;
char *node_uuid = NULL;
char *node_uuid_str = NULL;
@@ -8418,11 +8419,12 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
memset (key, 0, 256);
snprintf (key, 256, "last-scrub-time-%d", src_count);
- ret = dict_get_uint64 (rsp_dict, key, &value);
+ ret = dict_get_str (rsp_dict, key, &last_scrub_time);
if (!ret) {
+ scrub_time = gf_strdup (last_scrub_time);
memset (key, 0, 256);
snprintf (key, 256, "last-scrub-time-%d", src_count+dst_count);
- ret = dict_set_uint64 (aggr, key, value);
+ ret = dict_set_dynstr (aggr, key, scrub_time);
if (ret) {
gf_msg_debug (this->name, 0, "Failed to set "
"last scrub time value");
@@ -8544,7 +8546,8 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict)
uint64_t scrubbed_files = 0;
uint64_t unsigned_files = 0;
uint64_t scrub_duration = 0;
- uint64_t last_scrub_time = 0;
+ char *last_scrub_time = NULL;
+ char *scrub_time = NULL;
char *volname = NULL;
char *node_str = NULL;
char *scrub_freq = NULL;
@@ -8685,11 +8688,13 @@ glusterd_bitrot_volume_node_rsp (dict_t *aggr, dict_t *rsp_dict)
}
}
- ret = dict_get_uint64 (rsp_dict, "last-scrub-time", &value);
+ ret = dict_get_str (rsp_dict, "last-scrub-time", &last_scrub_time);
if (!ret) {
memset (key, 0, 256);
snprintf (key, 256, "last-scrub-time-%d", i);
- ret = dict_set_uint64 (aggr, key, value);
+
+ scrub_time = gf_strdup (last_scrub_time);
+ ret = dict_set_dynstr (aggr, key, scrub_time);
if (ret) {
gf_msg_debug (this->name, 0, "Failed to set "
"last scrub time value");