xen/xen-hvm-default-bridge.diff

87 lines
3.2 KiB
Diff
Raw Normal View History

Index: xen-3.0.4-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-3.0.4-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.0.4-testing/tools/examples/xend-config.sxp
@@ -116,7 +116,8 @@
#
# (network-script 'network-bridge netdev=eth1')
#
-# The bridge is named xenbr0, by default. To rename the bridge, use
+# The bridge is named to match the outgoing interface, by default. For example,
+# eth1 is on xenbr1. To rename the bridge, use
#
# (network-script 'network-bridge bridge=<name>')
#
Index: xen-3.0.4-testing/tools/ioemu/vl.c
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/vl.c
+++ xen-3.0.4-testing/tools/ioemu/vl.c
@@ -89,7 +89,6 @@
#include "exec-all.h"
#define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup"
-#define DEFAULT_BRIDGE "xenbr0"
//#define DEBUG_UNUSED_IOPORT
//#define DEBUG_IOPORT
@@ -3779,10 +3778,10 @@ int net_client_init(const char *str)
if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
}
- if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0) {
- pstrcpy(bridge, sizeof(bridge), DEFAULT_BRIDGE);
- }
- ret = net_tap_init(vlan, ifname, setup_script, bridge);
+ if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0)
+ ret = net_tap_init(vlan, ifname, setup_script, NULL);
+ else
+ ret = net_tap_init(vlan, ifname, setup_script, bridge);
}
} else
#endif
Index: xen-3.0.4-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.0.4-testing/tools/python/xen/xend/image.py
@@ -419,13 +419,16 @@ class HVMImageHandler(ImageHandler):
mac = devinfo.get('mac')
if mac is None:
mac = randomMAC()
- bridge = devinfo.get('bridge', 'xenbr0')
+ bridge = devinfo.get('bridge', None)
model = devinfo.get('model', 'rtl8139')
ret.append("-net")
ret.append("nic,vlan=%d,macaddr=%s,model=%s" %
(nics, mac, model))
ret.append("-net")
- ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge))
+ net = "tap,vlan=%d" % (nics,)
+ if bridge:
+ net += ",bridge=%s" % (bridge,)
+ ret.append(net)
return ret
Index: xen-3.0.4-testing/tools/ioemu/target-i386-dm/qemu-ifup
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/target-i386-dm/qemu-ifup
+++ xen-3.0.4-testing/tools/ioemu/target-i386-dm/qemu-ifup
@@ -1,10 +1,11 @@
#!/bin/sh
-#. /etc/rc.d/init.d/functions
-#ulimit -c unlimited
-
-echo -c 'config qemu network with xen bridge for '
-echo $*
+bridge=$2
+if [ -z "$bridge" ]; then
+ brnum=$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')
+ brnum=${brnum:-0}
+ bridge=xenbr${brnum}
+fi
ifconfig $1 0.0.0.0 up
-brctl addif $2 $1
+brctl addif $bridge $1