1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

Eventscripts - Rework the use of get_proc() for the bonding checks.

Call call_proc(), put the output into a variable and then use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2dfdc997f432d522034922b43cb6f8f878d11ba7)
This commit is contained in:
Martin Schwenke 2011-08-03 20:12:48 +10:00
parent 6fd94af5cc
commit 8026b3ce5a

View File

@ -46,21 +46,21 @@ monitor_interfaces()
# When we use VLANs for bond interfaces, there will only
# be an entry in /proc for the underlying real interface
local REALIFACE=`echo $IFACE |sed -e 's/\..*$//'`
get_proc "net/bonding/$REALIFACE" >/dev/null 2>&1 && {
get_proc "net/bonding/$REALIFACE" | grep -q 'Currently Active Slave: None' && {
bi=$(get_proc "net/bonding/$REALIFACE") 2>/dev/null && {
echo "$bi" | grep -q 'Currently Active Slave: None' && {
echo "ERROR: No active slaves for bond device $REALIFACE"
fail=1
ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
continue;
}
get_proc "net/bonding/$REALIFACE" | grep -q '^MII Status: up' || {
echo "$bi" | grep -q '^MII Status: up' || {
echo "ERROR: public network interface $REALIFACE is down"
fail=1
ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
continue;
}
grep -q '^Bonding Mode: IEEE 802.3ad Dynamic link aggregation' /proc/net/bonding/$REALIFACE && {
grep 'MII Status:' /proc/net/bonding/$REALIFACE | tail -n +2 | grep -q '^MII Status: up' || {
echo "$bi" | grep -q '^Bonding Mode: IEEE 802.3ad Dynamic link aggregation' && {
echo "$bi" | grep 'MII Status:' | tail -n +2 | grep -q '^MII Status: up' || {
echo No active slaves for 802.ad bond device $REALIFACE
ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
fail=1