On 01/17/2013 03:44 PM, Jean-François Lalau wrote: > > Being new to OVS, I performed a clean install of > - Debian Wheezy (weekly release for January 14) > - XEN 4.1.3 > - OVS from Debian package
[...] > I found some replacement scripts for the XEN supplied “vif-bridge” > scripts but none works and hours of searching for the issue in various > place brought nothing else than a headache. Did you find this post? http://lists.xen.org/archives/html/xen-users/2011-08/msg00071.html > So : > - Or is there some working scripts to replace native XEN scripts ? I haven't tested wheezy yet, but we've been using a slightly modified version of the vif-openvswitch script you can find in the post above since about a year in production with squeeze and backported openvswitch packages from wheezy. No bridge compat, the script directly issues openvswitch commands to attach the virtual interface of the domU to openvswitch. To use it, we set (vif-script vif-openvswitch) in /etc/xen/xend-config.sxp. You can find my version attached, diff it against the other one to see the changes. The author of the script chose to encode a specific (access-port) vlan to use into the bridge parameter of a vif in guest configuration, which could look like this (I use ovs0 instead of br0 for openvswitch): vif = [ "vifname=domU-0b-cb,mac=00:16:3e:00:0b:cb,bridge=ovs0.11", ] It's a bit weird because normally I use the dot-notation for vlan subinterfaces (like eth0.3) but while trying to fix that (refactoring it into e.g. bridge=ovs0,tag=11) we quickly discovered that's a pita, because adding an option name requires hacking around in lots of python files from xen. Anyway, it works (tm). I don't know how it fits together with xl instead of xm in Xen 4.1, not tested yet here. Hans van Kranenburg
#!/bin/bash #============================================================================ # ${XEN_SCRIPT_DIR}/vif-openvswitch # # Script for configuring a vif using Open vSwitch. # # Usage: # vif-openvswitch (add|remove|online|offline) # # Environment vars: # vif vif interface name (required). # XENBUS_PATH path to this device's details in the XenStore (required). # # Read from the store: # bridge bridge to add the vif to (optional). Defaults to searching for the # bridge itself. # # up: # Enslaves the vif interface to the bridge. # # down: # Removes the vif interface from the bridge. #============================================================================ dir=$(dirname "$0") . "$dir/vif-common.sh" bridge=${bridge:-} bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge") if [ -z "${bridge}" ] then bridge=$(ovs-vsctl listbr | cut -d " " -f 1) if [ -z "${bridge}" ] then fatal "Could not find bridge and none was specified" fi fi tag=${tag:-} # Domain on VLAN tagged bridge? RET=0 ovs-vsctl list-br | grep -c ${bridge} 1>/dev/null 2>&1 || RET=1 if [ $RET -eq 1 ] then if [[ $bridge =~ \.[[:digit:]]{1,4}$ ]] then tag=$(echo ${bridge} | cut -d "." -f 2) bridge=$(echo ${bridge} | cut -d "." -f 1) else fatal "Could not find bridge device ${bridge}" fi fi RET=0 ovs-vsctl list-br | grep -c ${bridge} 1>/dev/null 2>&1 || RET=1 if [ $RET -eq 1 ] then fatal "Could not find bridge device ${bridge}" fi if [ -z "${tag}" ] then log debug "Successful vif-openvswitch $command for ${vif}, bridge ${bridge}." else log debug "Successful vif-openvswitch $command for ${vif}, bridge ${bridge}, tag ${tag}." fi case "$command" in online) ifconfig "${vif}" 0.0.0.0 up if [ -z $tag ] then ovs-vsctl -- --may-exist add-port ${bridge} ${vif} else ovs-vsctl -- --may-exist add-port ${bridge} ${vif} tag=${tag} fi ;; offline) ovs-vsctl -- --if-exists del-port ${bridge} ${vif} ifconfig "$vif" 0.0.0.0 down ;; add) ;; esac if [ "$command" == "online" ] then success fi
_______________________________________________ discuss mailing list discuss@openvswitch.org http://openvswitch.org/mailman/listinfo/discuss