summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-09-01 13:01:22 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-09-06 23:05:37 -0700
commit86e312d872a957afff1e508f13f62c4102dba22d (patch)
tree3339b2180693ab20e8971538632331a59d23a9f3 /xlators/cluster/afr/src/afr-common.c
parentf20e41aec392a45f860fa7e80ad5ee9d5607a45c (diff)
afr: add replication events
Added the following events for the eventing framework: "EVENT_AFR_QUORUM_MET", --> Sent when quorum is met. "EVENT_AFR_QUORUM_FAIL" -->Sent when quorum is lost. "EVENT_AFR_SUBVOL_UP" -->Sent when afr witnesses the first up subvolume. "EVENT_AFR_SUBVOLS_DOWN"-->Sent when all children of an afr subvol are down. "EVENT_AFR_SPLIT_BRAIN" -->Sent when self-heal detects split-brain in heal path (not read/write path). Change-Id: I937c61ca1ce78b5922ade73c7bfa3051df59c513 BUG: 1371485 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/15349 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index cf838846cbd..8c59da7ecca 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -31,6 +31,7 @@
#include "byte-order.h"
#include "statedump.h"
#include "inode.h"
+#include "events.h"
#include "fd.h"
@@ -4422,6 +4423,9 @@ afr_notify (xlator_t *this, int32_t event,
AFR_MSG_SUBVOL_UP,
"Subvolume '%s' came back up; "
"going online.", ((xlator_t *)data)->name);
+ gf_event (EVENT_AFR_SUBVOL_UP,
+ "subvol=%s", this->name);
+
} else {
event = GF_EVENT_CHILD_MODIFIED;
}
@@ -4444,6 +4448,8 @@ afr_notify (xlator_t *this, int32_t event,
AFR_MSG_SUBVOLS_DOWN,
"All subvolumes are down. Going offline "
"until atleast one of them comes back up.");
+ gf_event (EVENT_AFR_SUBVOLS_DOWN,
+ "subvol=%s", this->name);
} else {
event = GF_EVENT_SOME_CHILD_DOWN;
}
@@ -4495,13 +4501,19 @@ afr_notify (xlator_t *this, int32_t event,
if (priv->quorum_count) {
has_quorum = afr_has_quorum (priv->child_up, this);
- if (!had_quorum && has_quorum)
+ if (!had_quorum && has_quorum) {
gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_QUORUM_MET,
"Client-quorum is met");
- if (had_quorum && !has_quorum)
+ gf_event (EVENT_AFR_QUORUM_MET,
+ "subvol=%s", this->name);
+ }
+ if (had_quorum && !has_quorum) {
gf_msg (this->name, GF_LOG_WARNING, 0,
AFR_MSG_QUORUM_FAIL,
"Client-quorum is not met");
+ gf_event (EVENT_AFR_QUORUM_FAIL, "subvol=%s",
+ this->name);
+ }
}
/* if all subvols have reported status, no need to hide anything