summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2017-01-17 15:43:47 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-01-19 20:01:47 -0800
commit2edd75ec8de17da89004859375844f60890a4df0 (patch)
tree4ff010534660c47c2475e2af27478f2c4a2c920f /xlators/mgmt/glusterd/src/glusterd-utils.c
parent7b5b7111c9d9a2a65e4f4d0abf832a88e021c576 (diff)
dht/rebalance Estimate time to complete rebalance
The estimates will be logged to the rebalance log on running gluster v rebalance <vol> status Change-Id: I9d51b139cd4c8dfde1ff2c2050720ae606c13fc6 BUG: 1396004 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: http://review.gluster.org/15893 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: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index c408f12c10d..21482752c53 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7613,6 +7613,7 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
dict_t *rsp_dict, int32_t cmd)
{
int ret = 0;
+ int ret2 = 0;
uint64_t files = 0;
uint64_t size = 0;
uint64_t lookup = 0;
@@ -7623,6 +7624,7 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
double run_time = 0;
uint64_t promoted = 0;
uint64_t demoted = 0;
+ uint64_t time_left = 0;
this = THIS;
@@ -7671,6 +7673,11 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
gf_msg_trace (this->name, 0,
"failed to get run-time");
+ ret2 = dict_get_uint64 (rsp_dict, "time-left", &time_left);
+ if (ret2)
+ gf_msg_trace (this->name, 0,
+ "failed to get time left");
+
if (cmd == GF_DEFRAG_CMD_STATUS_TIER) {
if (files)
volinfo->tier.rebalance_files = files;
@@ -7701,7 +7708,10 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
volinfo->rebal.skipped_files = skipped;
if (run_time)
volinfo->rebal.rebalance_time = run_time;
+ if (!ret2)
+ volinfo->rebal.time_left = time_left;
}
+
if (promoted)
volinfo->tier_info.promoted = promoted;
if (demoted)
@@ -9324,7 +9334,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_uint64 (ctx_dict, key, value);
if (ret) {
gf_msg_debug (THIS->name, 0,
- "failed to set lookuped file count");
+ "failed to set looked up file count");
}
}
@@ -9380,6 +9390,18 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
}
memset (key, 0, 256);
+ snprintf (key, 256, "time-left-%d", index);
+ ret = dict_get_uint64 (rsp_dict, key, &value);
+ if (!ret) {
+ memset (key, 0, 256);
+ snprintf (key, 256, "time-left-%d", current_index);
+ ret = dict_set_uint64 (ctx_dict, key, value);
+ if (ret) {
+ gf_msg_debug (THIS->name, 0,
+ "failed to set time-left");
+ }
+ }
+ memset (key, 0, 256);
snprintf (key, 256, "demoted-%d", index);
ret = dict_get_uint64 (rsp_dict, key, &value);
if (!ret) {
@@ -9521,7 +9543,7 @@ glusterd_volume_tier_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_uint64 (ctx_dict, key, value);
if (ret) {
gf_msg_debug (this->name, 0,
- "failed to set lookuped file count");
+ "failed to set looked up file count");
}
}
@@ -9601,6 +9623,19 @@ glusterd_volume_tier_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
}
}
+ memset (key, 0, 256);
+ snprintf (key, 256, "time-left-%d", index);
+ ret = dict_get_uint64 (rsp_dict, key, &value);
+ if (!ret) {
+ memset (key, 0, 256);
+ snprintf (key, 256, "time-left-%d", count);
+ ret = dict_set_uint64 (ctx_dict, key, value);
+ if (ret) {
+ gf_msg_debug (THIS->name, 0,
+ "failed to set time-left");
+ }
+ }
+
ret = dict_get_str (rsp_dict, GF_REMOVE_BRICK_TID_KEY,
&task_id_str);
if (ret) {
@@ -10271,6 +10306,14 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
glusterd_tier_or_rebalance_rsp (op_ctx, &volinfo->rebal, i);
memset (key, 0 , 256);
+ snprintf (key, 256, "time-left-%d", i);
+ ret = dict_set_uint64 (op_ctx, key, volinfo->rebal.time_left);
+ if (ret)
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
+ "failed to set time left");
+
+ memset (key, 0 , 256);
snprintf (key, 256, "promoted-%d", i);
ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.promoted);
if (ret)