summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-04-16 05:21:16 +0100
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-05-28 00:25:29 -0700
commit4e2bc057ee5afb412d9056dc71a6bb959fb11df6 (patch)
treec11e509158aa78a0153e92cb4f2e0d14293d47bb /xlators/mgmt
parentde04160253515dc55389af2f5750f856d150ee5e (diff)
glusterd: add counter support for tiered volumes
back port of http://review.gluster.org/10292 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> Change-Id: I543e886f17132b544274c83fdecca5a8da9d092a BUG: 1221477 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10775 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c55
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
2 files changed, 57 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 04e5707058a..9445de77127 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6707,6 +6707,8 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
uint64_t skipped = 0;
xlator_t *this = NULL;
double run_time = 0;
+ uint64_t promoted = 0;
+ uint64_t demoted = 0;
this = THIS;
@@ -6740,6 +6742,16 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
gf_log (this->name, GF_LOG_TRACE,
"failed to get skipped count");
+ ret = dict_get_uint64 (rsp_dict, "promoted", &promoted);
+ if (ret)
+ gf_log (this->name, GF_LOG_TRACE,
+ "failed to get promoted count");
+
+ ret = dict_get_uint64 (rsp_dict, "demoted", &demoted);
+ if (ret)
+ gf_log (this->name, GF_LOG_TRACE,
+ "failed to get demoted count");
+
ret = dict_get_double (rsp_dict, "run-time", &run_time);
if (ret)
gf_log (this->name, GF_LOG_TRACE,
@@ -6759,6 +6771,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 (promoted)
+ volinfo->tier_info.promoted = promoted;
+ if (demoted)
+ volinfo->tier_info.demoted = demoted;
return ret;
}
@@ -7863,6 +7879,31 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
}
}
+ memset (key, 0, 256);
+ snprintf (key, 256, "demoted-%d", index);
+ ret = dict_get_uint64 (rsp_dict, key, &value);
+ if (!ret) {
+ memset (key, 0, 256);
+ snprintf (key, 256, "demoted-%d", current_index);
+ ret = dict_set_uint64 (ctx_dict, key, value);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "failed to set demoted count");
+ }
+ }
+ memset (key, 0, 256);
+ snprintf (key, 256, "promoted-%d", index);
+ ret = dict_get_uint64 (rsp_dict, key, &value);
+ if (!ret) {
+ memset (key, 0, 256);
+ snprintf (key, 256, "promoted-%d", current_index);
+ ret = dict_set_uint64 (ctx_dict, key, value);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "failed to set promoted count");
+ }
+ }
+
ret = 0;
out:
@@ -8467,6 +8508,20 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
gf_log (THIS->name, GF_LOG_ERROR,
"failed to set run-time");
+ memset (key, 0 , 256);
+ snprintf (key, 256, "promoted-%d", i);
+ ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.promoted);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "failed to set lookedup file count");
+
+ memset (key, 0 , 256);
+ snprintf (key, 256, "demoted-%d", i);
+ ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.demoted);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "failed to set lookedup file count");
+
out:
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 5341192e84a..384b6f4186e 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -314,6 +314,8 @@ typedef struct tier_info_ {
int hot_type;
int hot_brick_count;
int hot_replica_count;
+ int promoted;
+ int demoted;
} gd_tier_info_t;
struct glusterd_volinfo_ {