summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuthu-vigneshwaran <mvignesh@redhat.com>2016-08-22 16:53:59 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-08-25 05:18:59 -0700
commite68a8eb6c5846d7386e97b0f0f23b49c5d38a6b5 (patch)
tree26f2926d23db2258e407075c4085f33ea1453a30
parentc68b561f048a02f479819b1c9cb3b5b896db18a6 (diff)
quota: add quota events
The patch targets to capture quota related events which are important to be notified. Change-Id: Iba440d675b11c346faab4c23260899d05296d8a7 BUG: 1368931 Signed-off-by: Muthu-vigneshwaran <mvignesh@redhat.com> Reviewed-on: http://review.gluster.org/15235 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Manikandan Selvaganesh <mselvaga@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r--events/eventskeygen.py2
-rw-r--r--xlators/features/quota/src/quota.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 41f75c2fb7d..b55c29ae5a6 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -90,7 +90,7 @@ keys = (
"EVENT_QUOTA_SOFT_TIMEOUT",
"EVENT_QUOTA_HARD_TIMEOUT",
"EVENT_QUOTA_DEFAULT_SOFT_LIMIT",
-
+ "EVENT_QUOTA_CROSSED_SOFT_LIMIT",
)
LAST_EVENT = "EVENT_LAST"
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 06007fb0aff..350e8ac8de0 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -15,6 +15,7 @@
#include "statedump.h"
#include "quota-common-utils.h"
#include "quota-messages.h"
+#include "events.h"
struct volume_options options[];
@@ -5008,7 +5009,12 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
gf_msg (this->name, GF_LOG_ALERT, 0,
Q_MSG_CROSSED_SOFT_LIMIT, "Usage crossed soft limit: "
"%s used by %s", usage_str, path);
+
+ gf_event (EVENT_QUOTA_CROSSED_SOFT_LIMIT, "Usage=%s;volume=%s;"
+ "path=%s", usage_str, priv->volume_uuid, path);
+
ctx->prev_log = cur_time;
+
}
/* Usage is above soft limit */
else if (cur_size > ctx->soft_lim &&
@@ -5020,6 +5026,10 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
gf_msg (this->name, GF_LOG_ALERT, 0, Q_MSG_CROSSED_SOFT_LIMIT,
"Usage is above soft limit: %s used by %s",
usage_str, path);
+
+ gf_event (EVENT_QUOTA_CROSSED_SOFT_LIMIT, "Usage=%s;volume=%s;"
+ "path=%s", usage_str, priv->volume_uuid, path);
+
ctx->prev_log = cur_time;
}