xen/bridge-bonding.diff

48 lines
1.4 KiB
Diff

Index: xen-3.3.1-testing/tools/examples/network-bridge
===================================================================
--- xen-3.3.1-testing.orig/tools/examples/network-bridge
+++ xen-3.3.1-testing/tools/examples/network-bridge
@@ -241,6 +241,9 @@ op_start () {
return
fi
+ local bonded=""
+ [ -e /sys/class/net/${netdev}/bonding ] && bonded="yes"
+
vlans=$(find_active_vlans "${netdev}")
for vlan in $vlans ; do ifdown $vlan ; done
@@ -254,13 +257,27 @@ op_start () {
ip link set ${netdev} down
ip addr flush ${netdev}
fi
- ip link set ${netdev} name ${pdev}
- ip link set ${tdev} name ${bridge}
- setup_bridge_port ${pdev}
+ if [ "x${bonded}" = "xyes" ]
+ then
+ ip link set ${tdev} name ${bridge}
+ ln -sf /etc/sysconfig/network/ifcfg-${netdev} /etc/sysconfig/network/ifcfg-${pdev}
+ ifup ${pdev}
+ local gw=`ip route show dev ${pdev} | fgrep default | sed 's/default via //'`
+ ip addr flush ${pdev}
+ rm -f /etc/sysconfig/network/ifcfg-${pdev}
+ brctl addif ${bridge} ${pdev}
+ ip link set ${bridge} up
+ [ -n "$gw" ] && ip route add default via ${gw}
+ else
+ ip link set ${netdev} name ${pdev}
+ ip link set ${tdev} name ${bridge}
+
+ setup_bridge_port ${pdev}
- add_to_bridge2 ${bridge} ${pdev}
- do_ifup ${bridge}
+ add_to_bridge2 ${bridge} ${pdev}
+ do_ifup ${bridge}
+ fi
for vlan in $vlans ; do ifup $vlan ; done