summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorAnkit raj <anraj@redhat.com>2017-04-21 11:50:35 +0530
committerAmar Tumballi <amarts@redhat.com>2017-12-09 00:47:46 +0000
commit52915ee818e8a6d0f052d8a2deeadd8ff7bd85dc (patch)
tree8fa19e814d478afa7e035a4709c641866c7b6351 /xlators/cluster
parent1926cada4a7acf48aa7cbf5ef8bb8942ae10b522 (diff)
dht: Send an event when disks get full
Send an event if DHT determines that a subvol is getting full or running out of inodes. Change-Id: Ie026f4ee1832b5df1e80b16cb949b2cc31a25d6f Bug: 1440659 Signed-off-by: Ankit raj <anraj@redhat.com> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index b1de9ff44aa..c2b9b2e37c4 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -18,6 +18,7 @@
#include "defaults.h"
#include <sys/time.h>
+#include "events.h"
int
@@ -221,10 +222,12 @@ gf_boolean_t
dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
{
int i = 0;
+ char vol_name[256];
dht_conf_t *conf = NULL;
gf_boolean_t subvol_filled_inodes = _gf_false;
gf_boolean_t subvol_filled_space = _gf_false;
gf_boolean_t is_subvol_filled = _gf_false;
+ double usage = 0;
conf = this->private;
@@ -259,23 +262,38 @@ dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
if (subvol_filled_space && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
+ usage = 100 - conf->du_stats[i].avail_percent;
+
gf_msg (this->name, GF_LOG_WARNING, 0,
DHT_MSG_SUBVOL_INSUFF_SPACE,
"disk space on subvolume '%s' is getting "
"full (%.2f %%), consider adding more bricks",
- subvol->name,
- (100 - conf->du_stats[i].avail_percent));
+ subvol->name, usage);
+
+ strncpy(vol_name, this->name, sizeof(vol_name));
+ vol_name[(strlen(this->name)-4)] = '\0';
+
+ gf_event(EVENT_DHT_DISK_USAGE,
+ "volume=%s;subvol=%s;usage=%.2f %%",
+ vol_name, subvol->name, usage);
}
}
if (subvol_filled_inodes && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
+ usage = 100 - conf->du_stats[i].avail_inodes;
gf_msg (this->name, GF_LOG_CRITICAL, 0,
DHT_MSG_SUBVOL_INSUFF_INODES,
"inodes on subvolume '%s' are at "
"(%.2f %%), consider adding more bricks",
- subvol->name,
- (100 - conf->du_stats[i].avail_inodes));
+ subvol->name, usage);
+
+ strncpy(vol_name, this->name, sizeof(vol_name));
+ vol_name[(strlen(this->name)-4)] = '\0';
+
+ gf_event(EVENT_DHT_INODES_USAGE,
+ "volume=%s;subvol=%s;usage=%.2f %%",
+ vol_name, subvol->name, usage);
}
}