Multi Bridge Xen
Kris explained in a previous blog post how you can create multiple bridges.
While testing the multiple bridges in a situation where every bridge is connected to a physical interface and that every virtual interface must be connected to the correct bridge (peth0->xenbr0->vifX.0; peth1->xenbr1->vifX.1; …) I noticed something strange.
The vif interface was not always connected to the correct bridge. When the bridgename is provided in the configuration file (with or without the mac address) the first entry is not always mapped to vifX.0.
A wrapper script brought again a solution. The vif-wrapper-bridge script will chech the name of the vif interface and use the last number (interface number) to define the bridge. That bridgename is stored in the xenstore and used by the vif-bridge script.
[root@GW-Y ~]$ grep wrapper xend-config.sxp
(network-script network-wrapper-bridge)
(vif-script vif-wrapper-bridge)
vif-wrapper-bridge
#!/bin/sh
if [ $1 = "online" ]
then
# load some general functions
dir=$(dirname "$0")
. "$dir/vif-common.sh"
# find the bridge number out of the vif interface name
brnum=$(echo $vif | sed 's/vif.*\.//')
bridge=xenbr$brnum
# store the bridgename in xenstore
bridge=$(xenstore_write "$XENBUS_PATH/bridge" "$bridge")
fi
# load the real vif-bridge script
/etc/xen/scripts/vif-bridge $1
October 18th, 2007
For a description of (and a solution for) this problem, see http://lists.xensource.com/archives/html/xen-devel/2007-01/msg01001.html
Short: The Problem comes from dict handling in Python, default dicts are not ordered.