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