From 6c0a3aa59ed28dceddd8e5f09fdad12e255639ee Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 25 Oct 2010 09:15:18 -0700 Subject: Wait to bring up bond interface until end Setting bonding parameter requires setting interface down. Avoid flapping interface unnecessarily on boot, by defering setting link up until end of boot. --- templates/interfaces/bonding/node.def | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def index 211140da..2346c490 100644 --- a/templates/interfaces/bonding/node.def +++ b/templates/interfaces/bonding/node.def @@ -9,9 +9,10 @@ syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \ begin: if [ ! -f /sys/class/net/bonding_masters ]; then sudo modprobe bonding max_bonds=0 miimon=250 fi + create: sudo sh -c "echo +$VAR(@) > /sys/class/net/bonding_masters" || exit 1 - ip link set "$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on + touch /tmp/bonding_$VAR(@).$PPID + delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`; if [ -z "$SLAVES" ] then @@ -20,3 +21,9 @@ delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`; echo "bonded interface $VAR(@) still has slaves: $SLAVES" exit 1; fi + +end: if [ -f /tmp/bonding_$VAR(@).$PPID ] + then rm -f /tmp/bonding_$VAR(@).$PPID + ip link set "$VAR(@)" up + /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on + fi -- cgit v1.2.3