Blob Blame History Raw
From e27365c0ab577aefc7e0b45dacb47f28510b8036 Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Tue, 30 Aug 2016 14:17:58 +0530
Subject: [PATCH 63/86] cluster/ec: Add events for EC translator

This patch will generates events in following
cases which will be consumed by new event
framework.

Consider an EC volume with (K+M) configuration
K = Data bricks
M = Redundancy bricks

1- EVENT_EC_MIN_BRICKS_NOT_UP -
   When minimum "K" number of bricks, required
   for any ec fop, are not up.
2- EVENT_EC_MIN_BRICKS_UP
   When minimum "K" number of bricks, required
   for any ec fop, are up.

>Change-Id: I0414b8968c39740a171e5aa14b087afd524d574f
>BUG: 1371470
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
>Reviewed-on: http://review.gluster.org/15348
>Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>

Change-Id: I0414b8968c39740a171e5aa14b087afd524d574f
BUG: 1361084
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/84812
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 events/eventskeygen.py      |    4 ++--
 xlators/cluster/ec/src/ec.c |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 801bee3..9906a26 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -124,8 +124,8 @@ keys = (
     "EVENT_COMPARE_FRIEND_VOLUME_FAILED",
     "EVENT_NFS_GANESHA_EXPORT_FAILED",
     #ec events
-    "EVENT_EC_DATA_BRICKS_NOT_UP",
-    "EVENT_EC_DATA_BRICKS_UP",
+    "EVENT_EC_MIN_BRICKS_NOT_UP",
+    "EVENT_EC_MIN_BRICKS_UP",
     #georep async events
     "EVENT_GEOREP_FAULTY",
     #quota async events
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
index 94d1241..591ab25 100644
--- a/xlators/cluster/ec/src/ec.c
+++ b/xlators/cluster/ec/src/ec.c
@@ -20,6 +20,7 @@
 #include "ec.h"
 #include "ec-messages.h"
 #include "ec-heald.h"
+#include "events.h"
 
 static char *ec_read_policies[EC_READ_POLICY_MAX + 1] = {
         [EC_ROUND_ROBIN] = "round-robin",
@@ -313,6 +314,7 @@ ec_up (xlator_t *this, ec_t *ec)
         ec->up = 1;
         gf_msg (this->name, GF_LOG_INFO, 0,
                 EC_MSG_EC_UP, "Going UP");
+        gf_event (EVENT_EC_MIN_BRICKS_UP, "subvol=%s", this->name);
 }
 
 void
@@ -326,6 +328,7 @@ ec_down (xlator_t *this, ec_t *ec)
         ec->up = 0;
         gf_msg (this->name, GF_LOG_INFO, 0,
                 EC_MSG_EC_DOWN, "Going DOWN");
+        gf_event (EVENT_EC_MIN_BRICKS_NOT_UP, "subvol=%s", this->name);
 }
 
 void
@@ -433,7 +436,7 @@ void
 ec_pending_fops_completed(ec_t *ec)
 {
         if (ec->shutdown) {
-                default_notify(ec->xl, GF_EVENT_PARENT_DOWN, NULL);
+                default_notify (ec->xl, GF_EVENT_PARENT_DOWN, NULL);
         }
 }
 
-- 
1.7.1