X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=xenserver%2Fetc_xensource_scripts_vif;h=c649e926b0e436e8623645253f15358c0b57afbc;hb=0b64afd6a82059c4b16f7457b5fc4715b7ad110c;hp=aebb4ccdac59771dbf03b81b66f5a6f6de173070;hpb=f304568eaa5a160ebc2031b84abc3337771612b2;p=sliver-openvswitch.git diff --git a/xenserver/etc_xensource_scripts_vif b/xenserver/etc_xensource_scripts_vif index aebb4ccda..c649e926b 100755 --- a/xenserver/etc_xensource_scripts_vif +++ b/xenserver/etc_xensource_scripts_vif @@ -1,9 +1,17 @@ #!/bin/sh -# This file is based on /etc/xensource/script/vif from Citrix XenServer 5.0.0. -# The original file did not contain a copyright notice or license statement. -# +# Copyright (C) 2008,2009 Citrix Systems, Inc. # Copyright (C) 2009 Nicira Networks, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; version 2.1 only. with the special +# exception on linking described in file LICENSE. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. # CA-23900: Warning: when VIFs are added to windows guests with PV drivers the backend vif device is registered, # unregistered and then registered again. This causes the udev event to fire twice and this script runs twice. @@ -13,8 +21,9 @@ # Keep other-config/ keys in sync with device.ml:vif_udev_keys -cfg_mod="/root/vswitch/bin/ovs-cfg-mod" -dump_vif_details="/root/vswitch/scripts/dump-vif-details" +cfg_mod="/usr/bin/ovs-cfg-mod" +vsctl="/usr/bin/ovs-vsctl" +dump_vif_details="/usr/share/vswitch/scripts/dump-vif-details" service="/sbin/service" TYPE=`echo ${XENBUS_PATH} | cut -f 2 -d '/'` @@ -33,8 +42,8 @@ handle_promiscuous() local arg=$(xenstore-read "${PRIVATE}/other-config/promiscuous") if [ $? -eq 0 -a -n "${arg}" ] ; then case "${arg}" in - true|on) echo 1 > /sys/class/net/${vif}/brport/promisc ;; - *) echo 0 > /sys/class/net/${vif}/brport/promisc ;; + true|on) logger -t script-vif "${vif}: Promiscuous ports are not supported via vSwitch." ;; + *) ;; esac fi } @@ -72,13 +81,11 @@ add_to_bridge() fi logger -t scripts-vif "Adding ${vif} to ${bridge} with address ${address}" - vid= - if [ -e "/etc/openvswitch/br-$bridge" ]; then - . "/etc/openvswitch/br-$bridge" - if [ -n "$VLAN_SLAVE" -a -n "$VLAN_VID" ]; then - bridge=$VLAN_SLAVE - vid="--add=vlan.$vif.tag=$VLAN_VID" - fi + local VLAN_ID=$($vsctl br-to-vlan $bridge) + local vid= + if [ "$VLAN_ID" -ne 0 ] ; then + bridge=$($vsctl br-to-parent $bridge) + vid="--add=vlan.${vif}.tag=${VLAN_ID}" fi ${IP} link set "${vif}" down || logger -t scripts-vif "Failed to ip link set ${vif} down" @@ -94,7 +101,8 @@ add_to_bridge() $cfg_mod -F /etc/ovs-vswitchd.conf \ --del-match="bridge.*.port=$vif" \ - --del-match="vlan.$vif.[!0-9]*" \ + --del-match="vlan.$vif.trunks=*" \ + --del-match="vlan.$vif.tag=*" \ --del-match="port.$vif.[!0-9]*" \ --add="bridge.$bridge.port=$vif" \ $vid $vif_details -c @@ -130,7 +138,8 @@ remove) logger -t scripts-vif "${vif} has been removed" $cfg_mod -vANY:console:emer -F /etc/ovs-vswitchd.conf \ --del-match="bridge.*.port=${vif}" \ - --del-match="vlan.${vif}.[!0-9]*" \ + --del-match="vlan.${vif}.trunks=*" \ + --del-match="vlan.${vif}.tag=*" \ --del-match="port.${vif}.[!0-9]*" -c $service vswitch reload ;;