|
|
21ab4e |
From 68b385605f52503f8c80ebf0aa15fd278b5db6d0 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: N Balachandran <nbalacha@redhat.com>
|
|
|
21ab4e |
Date: Tue, 17 Jan 2017 15:43:47 +0530
|
|
|
21ab4e |
Subject: [PATCH 314/361] dht/rebalance Estimate time to complete rebalance
|
|
|
21ab4e |
|
|
|
21ab4e |
The estimates will be logged to the rebalance log on running
|
|
|
21ab4e |
gluster v rebalance <vol> status
|
|
|
21ab4e |
|
|
|
21ab4e |
mainline:
|
|
|
21ab4e |
> BUG: 1396004
|
|
|
21ab4e |
> Reviewed-on: http://review.gluster.org/15893
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
21ab4e |
(cherry picked from commit 310405d689760fc1abe3075c4bcf6cf7351e60bc)
|
|
|
21ab4e |
|
|
|
21ab4e |
BUG: 1380598
|
|
|
21ab4e |
Change-Id: I9d51b139cd4c8dfde1ff2c2050720ae606c13fc6
|
|
|
21ab4e |
Signed-off-by: N Balachandran <nbalacha@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/101294
|
|
|
21ab4e |
Tested-by: Milind Changire <mchangir@redhat.com>
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
cli/src/cli-rpc-ops.c | 28 +++-
|
|
|
21ab4e |
xlators/cluster/dht/src/dht-rebalance.c | 102 +++++++++++-
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-utils.c | 251 ++++++++++++++++++++++++++++-
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd.h | 1 +
|
|
|
21ab4e |
4 files changed, 376 insertions(+), 6 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
21ab4e |
index 5a0cfdf..339d91b 100644
|
|
|
21ab4e |
--- a/cli/src/cli-rpc-ops.c
|
|
|
21ab4e |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
21ab4e |
@@ -1611,6 +1611,9 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
21ab4e |
int sec = 0;
|
|
|
21ab4e |
gf_boolean_t down = _gf_false;
|
|
|
21ab4e |
gf_boolean_t fix_layout = _gf_false;
|
|
|
21ab4e |
+ uint64_t max_time = 0;
|
|
|
21ab4e |
+ uint64_t time_left = 0;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
|
|
|
21ab4e |
ret = dict_get_int32 (dict, "count", &count);
|
|
|
21ab4e |
if (ret) {
|
|
|
21ab4e |
@@ -1663,6 +1666,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
21ab4e |
skipped = 0;
|
|
|
21ab4e |
status_str = NULL;
|
|
|
21ab4e |
elapsed = 0;
|
|
|
21ab4e |
+ time_left = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
/* Check if status is NOT_STARTED, and continue early */
|
|
|
21ab4e |
memset (key, 0, 256);
|
|
|
21ab4e |
@@ -1740,6 +1744,15 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
gf_log ("cli", GF_LOG_TRACE, "failed to get run-time");
|
|
|
21ab4e |
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", i);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (dict, key, &time_left);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_log ("cli", GF_LOG_TRACE,
|
|
|
21ab4e |
+ "failed to get time left");
|
|
|
21ab4e |
+ if (time_left > max_time)
|
|
|
21ab4e |
+ max_time = time_left;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
/* Check for array bound */
|
|
|
21ab4e |
if (status_rcd >= GF_DEFRAG_STATUS_MAX)
|
|
|
21ab4e |
status_rcd = GF_DEFRAG_STATUS_MAX;
|
|
|
21ab4e |
@@ -1757,15 +1770,15 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
21ab4e |
if (size_str) {
|
|
|
21ab4e |
cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64
|
|
|
21ab4e |
" %13" PRIu64" %13"PRIu64 " %20s "
|
|
|
21ab4e |
- "%8d:%d:%d", node_name, files,
|
|
|
21ab4e |
+ "%8d:%02d:%02d", node_name, files,
|
|
|
21ab4e |
size_str, lookup, failures, skipped,
|
|
|
21ab4e |
status_str, hrs, min, sec);
|
|
|
21ab4e |
} else {
|
|
|
21ab4e |
cli_out ("%40s %16"PRIu64 " %13"PRIu64 " %13"
|
|
|
21ab4e |
PRIu64 " %13"PRIu64" %13"PRIu64 " %20s"
|
|
|
21ab4e |
- " %8d:%d:%d", node_name, files, size,
|
|
|
21ab4e |
- lookup, failures, skipped, status_str,
|
|
|
21ab4e |
- hrs, min, sec);
|
|
|
21ab4e |
+ " %8d:%02d:%02d", node_name, files,
|
|
|
21ab4e |
+ size, lookup, failures, skipped,
|
|
|
21ab4e |
+ status_str, hrs, min, sec);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
GF_FREE(size_str);
|
|
|
21ab4e |
@@ -1775,6 +1788,13 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
21ab4e |
" Please check the nodes that are down using \'gluster"
|
|
|
21ab4e |
" peer status\' and start the glusterd on those nodes,"
|
|
|
21ab4e |
" else tier detach commit might fail!");
|
|
|
21ab4e |
+ if (max_time) {
|
|
|
21ab4e |
+ hrs = max_time / 3600;
|
|
|
21ab4e |
+ min = ((int) max_time % 3600) / 60;
|
|
|
21ab4e |
+ sec = ((int) max_time % 3600) % 60;
|
|
|
21ab4e |
+ cli_out ("Estimated time left for rebalance to complete :"
|
|
|
21ab4e |
+ " %8d:%02d:%02d", hrs, min, sec);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
return ret;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
index 39a7bb6..76778de 100644
|
|
|
21ab4e |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
@@ -46,6 +46,9 @@
|
|
|
21ab4e |
} \
|
|
|
21ab4e |
} \
|
|
|
21ab4e |
|
|
|
21ab4e |
+uint64_t g_totalfiles = 0;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+
|
|
|
21ab4e |
void
|
|
|
21ab4e |
gf_defrag_free_container (struct dht_container *container)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
@@ -3701,6 +3704,58 @@ gf_tier_wait_fix_lookup (gf_defrag_info_t *defrag) {
|
|
|
21ab4e |
/******************Tier background Fix layout functions END********************/
|
|
|
21ab4e |
|
|
|
21ab4e |
|
|
|
21ab4e |
+uint64_t gf_defrag_subvol_file_cnt (xlator_t *this, loc_t *root_loc)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ int ret = -1;
|
|
|
21ab4e |
+ struct statvfs buf = {0,};
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (!this)
|
|
|
21ab4e |
+ return 0;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = syncop_statfs (this, root_loc, &buf, NULL, NULL);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ /* Aargh! */
|
|
|
21ab4e |
+ return 0;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ return (buf.f_files - buf.f_ffree);
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+int gf_defrag_total_file_cnt (xlator_t *this, loc_t *root_loc)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ dht_conf_t *conf = NULL;
|
|
|
21ab4e |
+ int ret = -1;
|
|
|
21ab4e |
+ int i = 0;
|
|
|
21ab4e |
+ uint64_t num_files = 0;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ conf = this->private;
|
|
|
21ab4e |
+ if (!conf) {
|
|
|
21ab4e |
+ return ret;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ for (i = 0 ; i < conf->local_subvols_cnt; i++) {
|
|
|
21ab4e |
+ num_files = gf_defrag_subvol_file_cnt (conf->local_subvols[i],
|
|
|
21ab4e |
+ root_loc);
|
|
|
21ab4e |
+ g_totalfiles += num_files;
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_INFO, 0, 0, "local subvol: %s,"
|
|
|
21ab4e |
+ "cnt = %"PRIu64, conf->local_subvols[i]->name,
|
|
|
21ab4e |
+ num_files);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ /* FIXFIXFIX: halve the number of files to negate .glusterfs contents
|
|
|
21ab4e |
+ We need a better way to figure this out */
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ g_totalfiles = g_totalfiles/2;
|
|
|
21ab4e |
+ if (g_totalfiles > 20000)
|
|
|
21ab4e |
+ g_totalfiles += 10000;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_INFO, 0, 0,
|
|
|
21ab4e |
+ "Total number of files = %"PRIu64, g_totalfiles);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ return 0;
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
|
|
|
21ab4e |
int
|
|
|
21ab4e |
gf_defrag_start_crawl (void *data)
|
|
|
21ab4e |
@@ -3725,6 +3780,7 @@ gf_defrag_start_crawl (void *data)
|
|
|
21ab4e |
pthread_t *tid = NULL;
|
|
|
21ab4e |
gf_boolean_t is_tier_detach = _gf_false;
|
|
|
21ab4e |
|
|
|
21ab4e |
+
|
|
|
21ab4e |
this = data;
|
|
|
21ab4e |
if (!this)
|
|
|
21ab4e |
goto exit;
|
|
|
21ab4e |
@@ -3854,6 +3910,13 @@ gf_defrag_start_crawl (void *data)
|
|
|
21ab4e |
"are %s", conf->local_subvols[i]->name);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ ret = gf_defrag_total_file_cnt (this, &loc;;
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0, 0, "Failed to get "
|
|
|
21ab4e |
+ "the total number of files. Unable to estimate "
|
|
|
21ab4e |
+ "time to complete rebalance.");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
/* Initialize global entry queue */
|
|
|
21ab4e |
defrag->queue = GF_CALLOC (1, sizeof (struct dht_container),
|
|
|
21ab4e |
gf_dht_mt_container_t);
|
|
|
21ab4e |
@@ -4090,8 +4153,11 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
|
|
|
21ab4e |
uint64_t skipped = 0;
|
|
|
21ab4e |
uint64_t promoted = 0;
|
|
|
21ab4e |
uint64_t demoted = 0;
|
|
|
21ab4e |
- char *status = "";
|
|
|
21ab4e |
+ char *status = "";
|
|
|
21ab4e |
double elapsed = 0;
|
|
|
21ab4e |
+ uint64_t time_left = 0;
|
|
|
21ab4e |
+ uint64_t time_to_complete = 0;
|
|
|
21ab4e |
+ double rate_lookedup = 0;
|
|
|
21ab4e |
struct timeval end = {0,};
|
|
|
21ab4e |
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -4114,6 +4180,34 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
|
|
|
21ab4e |
|
|
|
21ab4e |
elapsed = end.tv_sec - defrag->start_time.tv_sec;
|
|
|
21ab4e |
|
|
|
21ab4e |
+/*START */
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+/* rate at which files looked up */
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER)
|
|
|
21ab4e |
+ && (defrag->defrag_status == GF_DEFRAG_STATUS_STARTED)
|
|
|
21ab4e |
+ && g_totalfiles) {
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ rate_lookedup = (defrag->num_files_lookedup)/elapsed;
|
|
|
21ab4e |
+ if (defrag->num_files_lookedup > g_totalfiles)
|
|
|
21ab4e |
+ g_totalfiles = defrag->num_files_lookedup + 10000;
|
|
|
21ab4e |
+ time_to_complete = (g_totalfiles)/rate_lookedup;
|
|
|
21ab4e |
+ time_left = time_to_complete - elapsed;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ gf_log (THIS->name, GF_LOG_INFO,
|
|
|
21ab4e |
+ "TIME: num_files_lookedup=%"PRIu64",elapsed time = %f,"
|
|
|
21ab4e |
+ "rate_lookedup=%f", defrag->num_files_lookedup, elapsed,
|
|
|
21ab4e |
+ rate_lookedup);
|
|
|
21ab4e |
+ gf_log (THIS->name, GF_LOG_INFO,
|
|
|
21ab4e |
+ "TIME: Estimated total time to complete = %"PRIu64
|
|
|
21ab4e |
+ " seconds", time_to_complete);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ gf_log (THIS->name, GF_LOG_INFO,
|
|
|
21ab4e |
+ "TIME: Seconds left = %"PRIu64" seconds", time_left);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+/*END */
|
|
|
21ab4e |
if (!dict)
|
|
|
21ab4e |
goto log;
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -4162,6 +4256,12 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
gf_log (THIS->name, GF_LOG_WARNING,
|
|
|
21ab4e |
"failed to set skipped file count");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = dict_set_uint64 (dict, "time-left", time_left);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_log (THIS->name, GF_LOG_WARNING,
|
|
|
21ab4e |
+ "failed to set time-left");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
log:
|
|
|
21ab4e |
switch (defrag->defrag_status) {
|
|
|
21ab4e |
case GF_DEFRAG_STATUS_NOT_STARTED:
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
index d849690..e976ba2 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
@@ -7586,6 +7586,7 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
dict_t *rsp_dict)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
int ret = 0;
|
|
|
21ab4e |
+ int ret2 = 0;
|
|
|
21ab4e |
uint64_t files = 0;
|
|
|
21ab4e |
uint64_t size = 0;
|
|
|
21ab4e |
uint64_t lookup = 0;
|
|
|
21ab4e |
@@ -7596,6 +7597,7 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
double run_time = 0;
|
|
|
21ab4e |
uint64_t promoted = 0;
|
|
|
21ab4e |
uint64_t demoted = 0;
|
|
|
21ab4e |
+ uint64_t time_left = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
this = THIS;
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -7658,6 +7660,11 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
volinfo->rebal.skipped_files = skipped;
|
|
|
21ab4e |
if (run_time)
|
|
|
21ab4e |
volinfo->rebal.rebalance_time = run_time;
|
|
|
21ab4e |
+ ret2 = dict_get_uint64 (rsp_dict, "time-left", &time_left);
|
|
|
21ab4e |
+ if (ret2)
|
|
|
21ab4e |
+ gf_msg_trace (this->name, 0,
|
|
|
21ab4e |
+ "failed to get time left");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
if (promoted)
|
|
|
21ab4e |
volinfo->tier_info.promoted = promoted;
|
|
|
21ab4e |
if (demoted)
|
|
|
21ab4e |
@@ -9254,7 +9261,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
|
|
|
21ab4e |
ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
if (ret) {
|
|
|
21ab4e |
gf_msg_debug (THIS->name, 0,
|
|
|
21ab4e |
- "failed to set lookuped file count");
|
|
|
21ab4e |
+ "failed to set looked up file count");
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -9310,6 +9317,18 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", current_index);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (THIS->name, 0,
|
|
|
21ab4e |
+ "failed to set time-left");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
snprintf (key, 256, "demoted-%d", index);
|
|
|
21ab4e |
ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
if (!ret) {
|
|
|
21ab4e |
@@ -9341,6 +9360,228 @@ out:
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
int
|
|
|
21ab4e |
+<<<<<<< 07a9e00a5702e76932142e9d9cdc2df601632b7a
|
|
|
21ab4e |
+=======
|
|
|
21ab4e |
+glusterd_volume_tier_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ char key[256] = {0,};
|
|
|
21ab4e |
+ char *node_uuid = NULL;
|
|
|
21ab4e |
+ char *node_uuid_str = NULL;
|
|
|
21ab4e |
+ char *volname = NULL;
|
|
|
21ab4e |
+ dict_t *ctx_dict = NULL;
|
|
|
21ab4e |
+ double elapsed_time = 0;
|
|
|
21ab4e |
+ glusterd_volinfo_t *volinfo = NULL;
|
|
|
21ab4e |
+ int ret = 0;
|
|
|
21ab4e |
+ int32_t index = 0;
|
|
|
21ab4e |
+ int32_t count = 0;
|
|
|
21ab4e |
+ int32_t value32 = 0;
|
|
|
21ab4e |
+ uint64_t value = 0;
|
|
|
21ab4e |
+ xlator_t *this = NULL;
|
|
|
21ab4e |
+ char *task_id_str = NULL;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ this = THIS;
|
|
|
21ab4e |
+ GF_VALIDATE_OR_GOTO (this->name, this, out);
|
|
|
21ab4e |
+ GF_VALIDATE_OR_GOTO (this->name, rsp_dict, out);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (aggr) {
|
|
|
21ab4e |
+ ctx_dict = aggr;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ } else {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_OPCTX_GET_FAIL,
|
|
|
21ab4e |
+ "Operation Context is not present");
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (!ctx_dict)
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = dict_get_str (ctx_dict, "volname", &volname);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_DICT_GET_FAILED,
|
|
|
21ab4e |
+ "Unable to get volume name");
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = glusterd_volinfo_find (volname, &volinfo);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = dict_get_int32 (rsp_dict, "count", &index);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_DICT_GET_FAILED,
|
|
|
21ab4e |
+ "failed to get index");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "node-uuid-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_str (rsp_dict, key, &node_uuid);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ node_uuid_str = gf_strdup (node_uuid);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ ret = dict_get_int32 (ctx_dict, "count", &count);
|
|
|
21ab4e |
+ count++;
|
|
|
21ab4e |
+ ret = dict_set_int32 (ctx_dict, "count", count);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_DICT_SET_FAILED,
|
|
|
21ab4e |
+ "Failed to set count");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "node-uuid-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_dynstr (ctx_dict, key, node_uuid_str);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set node-uuid");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ snprintf (key, 256, "files-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "files-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set the file count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "size-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "size-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set the size of migration");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "lookups-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "lookups-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set looked up file count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "status-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_int32 (rsp_dict, key, &value32);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "status-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_int32 (ctx_dict, key, value32);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set status");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "failures-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "failures-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set failure count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "skipped-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "skipped-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set skipped count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "run-time-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_double (rsp_dict, key, &elapsed_time);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "run-time-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_double (ctx_dict, key, elapsed_time);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set run-time");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "demoted-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "demoted-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set demoted count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "promoted-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "promoted-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0,
|
|
|
21ab4e |
+ "failed to set promoted count");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", index);
|
|
|
21ab4e |
+ ret = dict_get_uint64 (rsp_dict, key, &value);
|
|
|
21ab4e |
+ if (!ret) {
|
|
|
21ab4e |
+ memset (key, 0, 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", count);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (ctx_dict, key, value);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (THIS->name, 0,
|
|
|
21ab4e |
+ "failed to set time-left");
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = dict_get_str (rsp_dict, GF_REMOVE_BRICK_TID_KEY,
|
|
|
21ab4e |
+ &task_id_str);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, errno,
|
|
|
21ab4e |
+ "Missing remove-brick-id");
|
|
|
21ab4e |
+ } else
|
|
|
21ab4e |
+ ret = dict_set_str (ctx_dict, GF_REMOVE_BRICK_TID_KEY,
|
|
|
21ab4e |
+ task_id_str);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = 0;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+out:
|
|
|
21ab4e |
+ return ret;
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+int
|
|
|
21ab4e |
+>>>>>>> dht/rebalance Estimate time to complete rebalance
|
|
|
21ab4e |
glusterd_sys_exec_output_rsp_dict (dict_t *dst, dict_t *src)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
char output_name[PATH_MAX] = "";
|
|
|
21ab4e |
@@ -9976,6 +10217,14 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
|
|
|
21ab4e |
"failed to set run-time");
|
|
|
21ab4e |
|
|
|
21ab4e |
memset (key, 0 , 256);
|
|
|
21ab4e |
+ snprintf (key, 256, "time-left-%d", i);
|
|
|
21ab4e |
+ ret = dict_set_uint64 (op_ctx, key, volinfo->rebal.time_left);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
|
|
|
21ab4e |
+ GD_MSG_DICT_SET_FAILED,
|
|
|
21ab4e |
+ "failed to set time left");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ memset (key, 0 , 256);
|
|
|
21ab4e |
snprintf (key, 256, "promoted-%d", i);
|
|
|
21ab4e |
ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.promoted);
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
index a21b0a1..c84f019 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
@@ -308,6 +308,7 @@ struct glusterd_rebalance_ {
|
|
|
21ab4e |
uint64_t rebalance_failures;
|
|
|
21ab4e |
uuid_t rebalance_id;
|
|
|
21ab4e |
double rebalance_time;
|
|
|
21ab4e |
+ uint64_t time_left;
|
|
|
21ab4e |
glusterd_op_t op;
|
|
|
21ab4e |
dict_t *dict; /* Dict to store misc information
|
|
|
21ab4e |
* like list of bricks being removed */
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|