From 86e312d872a957afff1e508f13f62c4102dba22d Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 1 Sep 2016 13:01:22 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/15349 Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/cluster/afr/src/afr-common.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/afr/src/afr-common.c') 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 -- cgit