summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-04-16 05:21:16 +0100
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-05-08 10:38:08 -0700
commit680b3bf629f0fef038470baab62c6d6d8f5988ce (patch)
tree065e73785c42e9da18e2ffe6b85e518219b7a5d2 /xlators/cluster
parentd4d9cfc82d7cf7797227b8b929ba193fbaf389e6 (diff)
glusterd: add counter support for tiered volumes
This fix adds support to view the number of promoted or demoted files from the cli. The mechanism is isolmorphic to checking the status of volumes being rebalanced. gluster volume rebalance <vol> tier status Change-Id: I1b11ca27355ceec36c488967c23531202030e205 BUG: 1213063 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10292 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.c3
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c14
-rw-r--r--xlators/cluster/dht/src/tier.c6
3 files changed, 22 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index fbb4eaee4e5..54ad68246fb 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -6417,7 +6417,8 @@ dht_notify (xlator_t *this, int event, void *data, ...)
{
if (defrag->is_exiting)
goto unlock;
- if (cmd == GF_DEFRAG_CMD_STATUS)
+ if ((cmd == GF_DEFRAG_CMD_STATUS) ||
+ (cmd == GF_DEFRAG_CMD_STATUS_TIER))
gf_defrag_status_get (defrag, output);
else if (cmd == GF_DEFRAG_CMD_START_DETACH_TIER)
gf_defrag_start_detach_tier(defrag);
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 69d6f86019f..767b457ce77 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2820,6 +2820,8 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
uint64_t lookup = 0;
uint64_t failures = 0;
uint64_t skipped = 0;
+ uint64_t promoted = 0;
+ uint64_t demoted = 0;
char *status = "";
double elapsed = 0;
struct timeval end = {0,};
@@ -2837,6 +2839,8 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
lookup = defrag->num_files_lookedup;
failures = defrag->total_failures;
skipped = defrag->skipped;
+ promoted = defrag->total_files_promoted;
+ demoted = defrag->total_files_demoted;
gettimeofday (&end, NULL);
@@ -2845,6 +2849,16 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
if (!dict)
goto log;
+ ret = dict_set_uint64 (dict, "promoted", promoted);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to set promoted count");
+
+ ret = dict_set_uint64 (dict, "demoted", demoted);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to set demoted count");
+
ret = dict_set_uint64 (dict, "files", files);
if (ret)
gf_log (THIS->name, GF_LOG_WARNING,
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 72e8e47837e..2387a02b00c 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -365,6 +365,12 @@ tier_migrate_using_query_file (void *_args)
per_link_status = -1;
goto error;
}
+
+ if (query_cbk_args->is_promotion)
+ defrag->total_files_promoted++;
+ else
+ defrag->total_files_demoted++;
+
error:
loc_wipe(&loc);