summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c47
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
3 files changed, 47 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 3853e148893..00b84e076c3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -1072,7 +1072,7 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_NO_REBALANCE_PFX_IN_VOLNAME,
- "volname recieved (%s) is not prefixed with "
+ "volname received (%s) is not prefixed with "
"rebalance or tierd.", volname);
ret = -1;
goto out;
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)
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index e6a4d8b65a8..32f29526fb4 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -317,6 +317,7 @@ struct glusterd_rebalance_ {
uint64_t rebalance_failures;
uuid_t rebalance_id;
double rebalance_time;
+ uint64_t time_left;
glusterd_op_t op;
dict_t *dict; /* Dict to store misc information
* like list of bricks being removed */