ia64/xen-unstable

changeset 19564:cdc044f665dc

network-bridge: Fix for bonding

If ${netdev} is bonding, brctl addif ${bridge} ${pdev} fails:
can't add ${pdev} to bridge ${bridge}: Invalid argument
Because ${pdev} has no slaves at this point.=20
# Notice that ifdown ${netdev} clears slaves of ${netdev}.

This patch restores slaves before add_to_bridge2 ${bridge} ${pdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 22 11:26:37 2009 +0100 (2009-04-22)
parents 6ba4e34d21d3
children 1afc1ded0ed7
files tools/hotplug/Linux/network-bridge
line diff
     1.1 --- a/tools/hotplug/Linux/network-bridge	Tue Apr 21 16:31:26 2009 +0100
     1.2 +++ b/tools/hotplug/Linux/network-bridge	Wed Apr 22 11:26:37 2009 +0100
     1.3 @@ -223,6 +223,10 @@ op_start () {
     1.4  
     1.5      preiftransfer ${netdev}
     1.6      transfer_addrs ${netdev} ${tdev}
     1.7 +    # Remember slaves for bonding interface.
     1.8 +    if [ -e /sys/class/net/${netdev}/bonding/slaves ]; then
     1.9 +	slaves=`cat /sys/class/net/${netdev}/bonding/slaves`
    1.10 +    fi
    1.11      # Remember the IP details for do_ifup.
    1.12      get_ip_info ${netdev}
    1.13      if ! ifdown ${netdev}; then
    1.14 @@ -234,6 +238,11 @@ op_start () {
    1.15  
    1.16      setup_bridge_port ${pdev}
    1.17  
    1.18 +    # Restore slaves
    1.19 +    if [ -n "${slaves}" ]; then
    1.20 +	ip link set ${pdev} up
    1.21 +	ifenslave ${pdev} ${slaves}
    1.22 +    fi
    1.23      add_to_bridge2 ${bridge} ${pdev}
    1.24      do_ifup ${bridge}
    1.25