3604df
From 22b65c30c5eca015bb5aabf0a0d1d2c4aba21daa Mon Sep 17 00:00:00 2001
3604df
From: Muthu-vigneshwaran <mvignesh@redhat.com>
3604df
Date: Mon, 22 Aug 2016 16:53:59 +0530
3604df
Subject: [PATCH 51/86] quota: add quota events
3604df
3604df
The patch targets to capture quota related events which are
3604df
important to be notified.
3604df
3604df
>Reviewed-on: http://review.gluster.org/15235
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>Tested-by: Manikandan Selvaganesh <mselvaga@redhat.com>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com>
3604df
>Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
3604df
3604df
Change-Id: Iba440d675b11c346faab4c23260899d05296d8a7
3604df
BUG: 1361078
3604df
Signed-off-by: Muthu-vigneshwaran <mvignesh@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/84798
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Tested-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 events/eventskeygen.py             |    2 +-
3604df
 xlators/features/quota/src/quota.c |   10 ++++++++++
3604df
 2 files changed, 11 insertions(+), 1 deletions(-)
3604df
3604df
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
3604df
index 144c554..a118a4c 100644
3604df
--- a/events/eventskeygen.py
3604df
+++ b/events/eventskeygen.py
3604df
@@ -90,7 +90,7 @@ keys = (
3604df
     "EVENT_QUOTA_SOFT_TIMEOUT",
3604df
     "EVENT_QUOTA_HARD_TIMEOUT",
3604df
     "EVENT_QUOTA_DEFAULT_SOFT_LIMIT",
3604df
-
3604df
+    "EVENT_QUOTA_CROSSED_SOFT_LIMIT",
3604df
 )
3604df
 
3604df
 LAST_EVENT = "EVENT_LAST"
3604df
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
3604df
index dd7bf80..50eaa1f 100644
3604df
--- a/xlators/features/quota/src/quota.c
3604df
+++ b/xlators/features/quota/src/quota.c
3604df
@@ -15,6 +15,7 @@
3604df
 #include "statedump.h"
3604df
 #include "quota-common-utils.h"
3604df
 #include "quota-messages.h"
3604df
+#include "events.h"
3604df
 
3604df
 struct volume_options options[];
3604df
 
3604df
@@ -5008,7 +5009,12 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
3604df
                 gf_msg (this->name, GF_LOG_ALERT, 0,
3604df
                         Q_MSG_CROSSED_SOFT_LIMIT, "Usage crossed soft limit: "
3604df
                         "%s used by %s", usage_str, path);
3604df
+
3604df
+                gf_event (EVENT_QUOTA_CROSSED_SOFT_LIMIT, "Usage=%s;volume=%s;"
3604df
+                          "path=%s", usage_str, priv->volume_uuid, path);
3604df
+
3604df
                 ctx->prev_log = cur_time;
3604df
+
3604df
         }
3604df
         /* Usage is above soft limit */
3604df
         else if (cur_size > ctx->soft_lim &&
3604df
@@ -5020,6 +5026,10 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
3604df
                 gf_msg (this->name, GF_LOG_ALERT, 0, Q_MSG_CROSSED_SOFT_LIMIT,
3604df
                         "Usage is above soft limit: %s used by %s",
3604df
                         usage_str, path);
3604df
+
3604df
+                gf_event (EVENT_QUOTA_CROSSED_SOFT_LIMIT, "Usage=%s;volume=%s;"
3604df
+                          "path=%s", usage_str, priv->volume_uuid, path);
3604df
+
3604df
                 ctx->prev_log = cur_time;
3604df
         }
3604df
 
3604df
-- 
3604df
1.7.1
3604df