7f4c2a
From c8d1751014bc34d33dfe6db1820174ef7e733404 Mon Sep 17 00:00:00 2001
7f4c2a
From: Kaleb S. KEITHLEY <kkeithle@redhat.com>
7f4c2a
Date: Fri, 5 Jun 2015 10:56:25 -0400
7f4c2a
Subject: [PATCH 42/57]  nfs-ganesha: HA, fix race between setting grace and virt IP fail-over
7f4c2a
7f4c2a
upstream BZs: 1227028 (release-3.7), 1219485 (main), 1216039
7f4c2a
7f4c2a
Change-Id: I17eb2f7a5eae677123f12ab7eaf650fbf4d07682
7f4c2a
BUG: 1224618
7f4c2a
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/50134
7f4c2a
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
7f4c2a
Reviewed-by: Niels de Vos <ndevos@redhat.com>
7f4c2a
Tested-by: Niels de Vos <ndevos@redhat.com>
7f4c2a
---
7f4c2a
 extras/ganesha/ocf/ganesha_mon |   24 ++++++++++++++----------
7f4c2a
 1 files changed, 14 insertions(+), 10 deletions(-)
7f4c2a
7f4c2a
diff --git a/extras/ganesha/ocf/ganesha_mon b/extras/ganesha/ocf/ganesha_mon
7f4c2a
index 6ba7178..47943f8 100644
7f4c2a
--- a/extras/ganesha/ocf/ganesha_mon
7f4c2a
+++ b/extras/ganesha/ocf/ganesha_mon
7f4c2a
@@ -36,6 +36,8 @@ else
7f4c2a
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
7f4c2a
 fi
7f4c2a
 
7f4c2a
+GRACE_DELAY=7
7f4c2a
+
7f4c2a
 ganesha_meta_data() {
7f4c2a
         cat <
7f4c2a
 
7f4c2a
@@ -98,13 +100,7 @@ ganesha_mon_monitor()
7f4c2a
 
7f4c2a
 	if [ -e /var/run/ganesha.nfsd.pid -a \
7f4c2a
 	     -d /proc/$(cat /var/run/ganesha.nfsd.pid) ]; then
7f4c2a
-		# logger "note: ganesha_mon_monitor() pcs resource delete ${short_host}-dead_ip-1"
7f4c2a
-		pcs resource delete ${short_host}-dead_ip-1
7f4c2a
-		# if [ $? -ne 0 ]; then
7f4c2a
-		# 	logger "warning: pcs resource delete ${short_host}-dead_ip-1"
7f4c2a
-		# fi
7f4c2a
-
7f4c2a
-		sleep 1
7f4c2a
+		( pcs resource delete ${short_host}-dead_ip-1 > /dev/null 2>&1 )
7f4c2a
 
7f4c2a
 		attrd_updater -n ganesha-active -v 1
7f4c2a
 		if [ $? -ne 0 ]; then
7f4c2a
@@ -112,13 +108,21 @@ ganesha_mon_monitor()
7f4c2a
 		fi
7f4c2a
 
7f4c2a
 	else
7f4c2a
-		# logger "note: ganesha_mon_montor(), pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy"
7f4c2a
-		pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy
7f4c2a
+		( pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy > /dev/null 2>&1 )
7f4c2a
 		if [ $? -ne 0 ]; then
7f4c2a
 			logger "warning: pcs resource create ${short_host}-dead_ip-1 ocf:heartbeat:Dummy failed"
7f4c2a
 		fi
7f4c2a
 
7f4c2a
-		sleep 1
7f4c2a
+		# The ${this-node}-dead_ip-1 resource is used to indicate
7f4c2a
+		# that this ganesha.nfsd has died.
7f4c2a
+		# VIP fail-over is then triggered by clearing the
7f4c2a
+		# ganesha-active node attribute on this node.
7f4c2a
+		#
7f4c2a
+		# Meanwhile the ganesha_grace monitor() runs every 5
7f4c2a
+		# seconds. We need to allow time for it to run and put
7f4c2a
+		# the remaining ganesha.nfsds into grace before initiating
7f4c2a
+		# the VIP fail-over.
7f4c2a
+		sleep ${GRACE_DELAY}
7f4c2a
 
7f4c2a
 		attrd_updater -D -n ganesha-active
7f4c2a
 		if [ $? -ne 0 ]; then
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a