resource-agents: master - rgmanager: Simplify bonded link checking

Lon Hohberger lon at fedoraproject.org
Mon Oct 26 21:23:54 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a=commitdiff;h=1cd002b9fd12705d1e1f5629f8686cabb354559b
Commit:        1cd002b9fd12705d1e1f5629f8686cabb354559b
Parent:        e9b6563c9f800cc606210970702f235c07f56c10
Author:        Flavio Leitner <fleitner at redhat.com>
AuthorDate:    Tue Sep 29 09:40:32 2009 -0400
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Mon Oct 26 17:22:30 2009 -0400

rgmanager: Simplify bonded link checking

The new bonding driver version 3.4.0 provides ethtool get_link
operation so, now, usual link checking works for bonding devices.

Resolves: bz518037

Signed-off-by: Flavio Leitner <fleitner at redhat.com>
Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/resources/ip.sh |   75 +---------------------------------------
 1 files changed, 2 insertions(+), 73 deletions(-)

diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
index 7a7d6c5..445e873 100644
--- a/rgmanager/src/resources/ip.sh
+++ b/rgmanager/src/resources/ip.sh
@@ -408,46 +408,6 @@ ipv6_list_interfaces()
 }
 
 
-#
-# Find slaves for a bonded interface
-#
-findSlaves()
-{
-	declare mastif=$1
-	declare line
-	declare intf
-	declare interfaces
-
-	if [ -z "$mastif" ]; then
-		ocf_log err "usage: findSlaves <master I/F>"
-		return $OCF_ERR_ARGS
-	fi
-
-	line=$(/sbin/ip link list dev $mastif | grep "<.*MASTER.*>")
-	if [ $? -ne 0 ]; then
-		ocf_log err "Error determining status of $mastif"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -z "`/sbin/ip link list dev $mastif | grep \"<.*MASTER.*>\"`" ]
-	then
-		ocf_log err "$mastif is not a master device"
-		return $OCF_ERR_GENERIC
-	fi
-
-	## Strip possible VLAN (802.1q) suffixes 
-	##  - Roland Gadinger <roland.gadinger at beko.at> 
-	mastif=${mastif%%.*} 
-
-	while read line; do
-		set - $line
-		interfaces="${2/:/} $interfaces"
-	done < <( /sbin/ip -o link list | grep "master $mastif" )
-
-	echo $interfaces
-}
-
-
 isSlave()
 {
 	declare intf=$1
@@ -527,39 +487,8 @@ network_link_up()
 		return 1
 	fi
 	
-	#
-	# XXX assumes bond* interfaces are the bonding driver. (Fair
-	# assumption on Linux, I think)
-	#
-	if [ "${intf_arg/bond/}" != "$intf_arg" ]; then
-		
-		#
-		# With Xen we must check for slaves of pbondX, not bondX
-		#
-		masterif=$intf_arg
-		line=$(ip link list | awk {'print $2'} | grep "p$intf_arg:")
-		if [ $? -eq 0 ] ; then
-			masterif="p$intf_arg"
-		fi
-		
-		#
-		# Bonded driver.  Check link of all slaves for this interface.
-		# If any link is up, the bonding driver is expected to route
-		# traffic through that link.  Thus, the entire bonded link
-		# is declared up.
-		#
-		slaves=$(findSlaves $masterif)
-		if [ $? -ne 0 ]; then
-			ocf_log err "Error finding slaves of $intf_arg"
-			return 1
-		fi
-		for intf_test in $slaves; do
-			ethernet_link_up $intf_test && link_up=0
-		done
-	else
-		ethernet_link_up $intf_arg
-		link_up=$?
-	fi
+	ethernet_link_up $intf_arg
+	link_up=$?
 
 	if [ $link_up -eq 0 ]; then
 		ocf_log debug "Link for $intf_arg: Detected"


More information about the cluster-commits mailing list