X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=xenserver%2Fetc_xensource_scripts_vif;h=c649e926b0e436e8623645253f15358c0b57afbc;hb=a68813c3dce6597c302c1d112f88b8020c4d2eba;hp=572f5af0ca4f41c62106cf7ac1ccc19f6bc7c52d;hpb=42061b2a5b79d44c0ff9442a8203f0c7672ee9cf;p=openvswitch diff --git a/xenserver/etc_xensource_scripts_vif b/xenserver/etc_xensource_scripts_vif index 572f5af0..c649e926 100755 --- a/xenserver/etc_xensource_scripts_vif +++ b/xenserver/etc_xensource_scripts_vif @@ -1,7 +1,17 @@ #!/bin/sh -# Copyright (C) 2008,2009 Citrix Systems, Inc. All rights reserved. +# 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. @@ -11,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 '/'` @@ -70,13 +81,11 @@ add_to_bridge() fi logger -t scripts-vif "Adding ${vif} to ${bridge} with address ${address}" - vid= - if [ -e "/var/lib/openvswitch/br-$bridge" ]; then - . "/var/lib/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"