Blame SOURCES/bz1434351-IPaddr2-send-arp-monitor-action.patch

15862b
From ac89df16142faf972cdb88bd8599329fbc15ffb1 Mon Sep 17 00:00:00 2001
15862b
From: Andrea Ieri <ani@open.ch>
15862b
Date: Fri, 28 Oct 2016 13:37:45 +0200
15862b
Subject: [PATCH 1/2] Medium: IPaddr2: add option to enable sending refresh arp
15862b
 packets in monitor
15862b
15862b
This commit introduces a new parameter:
15862b
OCF_RESKEY_arp_count_refresh_default (default: 0)
15862b
15862b
This parameter allows to specify whether to send gratuitous ARP packets during
15862b
the monitoring of the resource, and how many.
15862b
This is to alleviate issues with potentially stuck switch ARP caches,
15862b
which can arise in case of split brain situations. Example:
15862b
- a two node cluster is interconnected directly as well as through a switch.
15862b
  Node A is master, node B is slave
15862b
- communication between master and slave is severed (split brain)
15862b
- node B initializes the virtual IPs and sends gratuitous ARP packets
15862b
- the switch updated its ARP table to point to B
15862b
- node B dies (without node A noticing)
15862b
- node A never notices anything wrong
15862b
- the switch fails to notice that the virtual IP belongs to A
15862b
---
15862b
 heartbeat/IPaddr2 | 52 +++++++++++++++++++++++++++++++++++++---------------
15862b
 1 file changed, 37 insertions(+), 15 deletions(-)
15862b
15862b
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
15862b
index b224ca5..c49d638 100755
15862b
--- a/heartbeat/IPaddr2
15862b
+++ b/heartbeat/IPaddr2
15862b
@@ -76,6 +76,7 @@ OCF_RESKEY_clusterip_hash_default="sourceip-sourceport"
15862b
 OCF_RESKEY_unique_clone_address_default=false
15862b
 OCF_RESKEY_arp_interval_default=200
15862b
 OCF_RESKEY_arp_count_default=5
15862b
+OCF_RESKEY_arp_count_refresh_default=0
15862b
 OCF_RESKEY_arp_bg_default=true
15862b
 OCF_RESKEY_arp_mac_default="ffffffffffff"
15862b
 
15862b
@@ -86,6 +87,7 @@ OCF_RESKEY_arp_mac_default="ffffffffffff"
15862b
 : ${OCF_RESKEY_unique_clone_address=${OCF_RESKEY_unique_clone_address_default}}
15862b
 : ${OCF_RESKEY_arp_interval=${OCF_RESKEY_arp_interval_default}}
15862b
 : ${OCF_RESKEY_arp_count=${OCF_RESKEY_arp_count_default}}
15862b
+: ${OCF_RESKEY_arp_count_refresh=${OCF_RESKEY_arp_count_refresh_default}}
15862b
 : ${OCF_RESKEY_arp_bg=${OCF_RESKEY_arp_bg_default}}
15862b
 : ${OCF_RESKEY_arp_mac=${OCF_RESKEY_arp_mac_default}}
15862b
 #######################################################################
15862b
@@ -274,12 +276,22 @@ Specify the interval between unsolicited ARP packets in milliseconds.
15862b
 
15862b
 <parameter name="arp_count">
15862b
 <longdesc lang="en">
15862b
-Number of unsolicited ARP packets to send.
15862b
+Number of unsolicited ARP packets to send at resource initialization.
15862b
 </longdesc>
15862b
-<shortdesc lang="en">ARP packet count</shortdesc>
15862b
+<shortdesc lang="en">ARP packet count sent during initialization</shortdesc>
15862b
 <content type="integer" default="${OCF_RESKEY_arp_count_default}"/>
15862b
 </parameter>
15862b
 
15862b
+<parameter name="arp_count_refresh">
15862b
+<longdesc lang="en">
15862b
+Number of unsolicited ARP packets to send during resource monitoring. Doing
15862b
+so helps mitigate issues of stuck ARP caches resulting from split-brain
15862b
+situations.
15862b
+</longdesc>
15862b
+<shortdesc lang="en">ARP packet count sent during monitoring</shortdesc>
15862b
+<content type="integer" default="${OCF_RESKEY_arp_count_refresh_default}"/>
15862b
+</parameter>
15862b
+
15862b
 <parameter name="arp_bg">
15862b
 <longdesc lang="en">
15862b
 Whether or not to send the ARP packets in the background.
15862b
@@ -660,20 +672,25 @@ is_infiniband() {
15862b
 # Run send_arp to note peers about new mac address
15862b
 #
15862b
 run_send_arp() {
15862b
-	ARGS="-i $OCF_RESKEY_arp_interval -r $OCF_RESKEY_arp_count -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip auto not_used not_used"
15862b
 	if [ "x$IP_CIP" = "xyes" ] ; then
15862b
 	    if [ x = "x$IF_MAC" ] ; then
15862b
 		MY_MAC=auto
15862b
 	    else
15862b
 		MY_MAC=`echo ${IF_MAC} | sed -e 's/://g'`
15862b
 	    fi
15862b
-	    ARGS="-i $OCF_RESKEY_arp_interval -r $OCF_RESKEY_arp_count -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
15862b
-	fi
15862b
-	ocf_log info "$SENDARP $ARGS"
15862b
-	if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
-		($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
 	else
15862b
-		$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+		MY_MAC=auto
15862b
+	fi
15862b
+	[ "x$1" = "xrefresh" ] && ARP_COUNT=$OCF_RESKEY_arp_count_refresh \
15862b
+			       || ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+	if [ $ARP_COUNT -ne 0 ] ; then
15862b
+		ARGS="-i $OCF_RESKEY_arp_interval -r $ARP_COUNT -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
15862b
+		ocf_log info "$SENDARP $ARGS"
15862b
+		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
+			($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
+		else
15862b
+			$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+		fi
15862b
 	fi
15862b
 }
15862b
 
15862b
@@ -720,12 +737,16 @@ run_send_ua() {
15862b
 # Run ipoibarping to note peers about new Infiniband address
15862b
 #
15862b
 run_send_ib_arp() {
15862b
-	ARGS="-q -c $OCF_RESKEY_arp_count -U -I $NIC $OCF_RESKEY_ip"
15862b
-	ocf_log info "ipoibarping $ARGS"
15862b
-	if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
-		(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
-	else
15862b
-		ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+	[ "x$1" = "xrefresh" ] && ARP_COUNT=$OCF_RESKEY_arp_count_refresh \
15862b
+			       || ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+	if [ $ARP_COUNT -ne 0 ] ; then
15862b
+		ARGS="-q -c $ARP_COUNT -U -I $NIC $OCF_RESKEY_ip"
15862b
+		ocf_log info "ipoibarping $ARGS"
15862b
+		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
+			(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
+		else
15862b
+			ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+		fi
15862b
 	fi
15862b
 }
15862b
 
15862b
@@ -946,6 +967,7 @@ ip_monitor() {
15862b
 	local ip_status=`ip_served`
15862b
 	case $ip_status in
15862b
 	ok)
15862b
+		$ARP_SEND_FUN refresh
15862b
 		return $OCF_SUCCESS
15862b
 		;;
15862b
 	partial|no|partial2)
15862b
15862b
From aa1db299f0b684fb814e6c31e96890868fa90e04 Mon Sep 17 00:00:00 2001
15862b
From: Andrea Ieri <ani@open.ch>
15862b
Date: Fri, 4 Nov 2016 15:37:15 +0100
15862b
Subject: [PATCH 2/2] Low: IPaddr2: Log refresh arp packets at debug level
15862b
 instead of info
15862b
15862b
---
15862b
 heartbeat/IPaddr2 | 22 ++++++++++++++++------
15862b
 1 file changed, 16 insertions(+), 6 deletions(-)
15862b
15862b
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
15862b
index c49d638..c9acf59 100755
15862b
--- a/heartbeat/IPaddr2
15862b
+++ b/heartbeat/IPaddr2
15862b
@@ -681,11 +681,16 @@ run_send_arp() {
15862b
 	else
15862b
 		MY_MAC=auto
15862b
 	fi
15862b
-	[ "x$1" = "xrefresh" ] && ARP_COUNT=$OCF_RESKEY_arp_count_refresh \
15862b
-			       || ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+	if [ "x$1" = "xrefresh" ] ; then
15862b
+		ARP_COUNT=$OCF_RESKEY_arp_count_refresh
15862b
+		LOGLEVEL=debug
15862b
+	else
15862b
+		ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+		LOGLEVEL=info
15862b
+	fi
15862b
 	if [ $ARP_COUNT -ne 0 ] ; then
15862b
 		ARGS="-i $OCF_RESKEY_arp_interval -r $ARP_COUNT -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
15862b
-		ocf_log info "$SENDARP $ARGS"
15862b
+		ocf_log $LOGLEVEL "$SENDARP $ARGS"
15862b
 		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
 			($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
 		else
15862b
@@ -737,11 +742,16 @@ run_send_ua() {
15862b
 # Run ipoibarping to note peers about new Infiniband address
15862b
 #
15862b
 run_send_ib_arp() {
15862b
-	[ "x$1" = "xrefresh" ] && ARP_COUNT=$OCF_RESKEY_arp_count_refresh \
15862b
-			       || ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+	if [ "x$1" = "xrefresh" ] ; then
15862b
+		ARP_COUNT=$OCF_RESKEY_arp_count_refresh
15862b
+		LOGLEVEL=debug
15862b
+	else
15862b
+		ARP_COUNT=$OCF_RESKEY_arp_count
15862b
+		LOGLEVEL=info
15862b
+	fi
15862b
 	if [ $ARP_COUNT -ne 0 ] ; then
15862b
 		ARGS="-q -c $ARP_COUNT -U -I $NIC $OCF_RESKEY_ip"
15862b
-		ocf_log info "ipoibarping $ARGS"
15862b
+		ocf_log $LOGLEVEL "ipoibarping $ARGS"
15862b
 		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
 			(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
 		else