From 4e332e69bc67afb8f4683bb62837c7c0b93d4802 Mon Sep 17 00:00:00 2001 From: Xin Liang Date: Fri, 20 Jan 2017 10:31:12 +0800 Subject: [PATCH] add nic_monitor function so VIP can takeover by the other node WHEN the net wire been pulled --- heartbeat/IPaddr2 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 index cb9d19a146..c60b83aa9b 100755 --- a/heartbeat/IPaddr2 +++ b/heartbeat/IPaddr2 @@ -970,6 +970,14 @@ ip_stop() { exit $OCF_SUCCESS } +nic_monitor() +{ + ps -ef|grep -w "NetworkManager"|grep -v grep &> /dev/null + if [ "$?" -ne 0 ];then + ethtool $NIC|grep "Link detected: yes" &> /dev/null + fi +} + ip_monitor() { # TODO: Implement more elaborate monitoring like checking for # interface health maybe via a daemon like FailSafe etc... @@ -977,6 +985,7 @@ ip_monitor() { local ip_status=`ip_served` case $ip_status in ok) + nic_monitor || return $OCF_ERR_GENERIC $ARP_SEND_FUN refresh return $OCF_SUCCESS ;;