brcompatd: Make bridge ioctls synchronous again.
[openvswitch] / xenserver / etc_xensource_scripts_vif
index 90151d1fb3e337b64d5c7cb5ef882d35fc493be4..3a209f9b4ae315d732483d0d6fb8f9f4eb1323d5 100755 (executable)
@@ -24,7 +24,6 @@ BRCTL="/usr/sbin/brctl"
 IP="/sbin/ip"
 
 vsctl="/usr/bin/ovs-vsctl"
-dump_vif_details="/usr/share/vswitch/scripts/dump-vif-details"
 
 handle_promiscuous()
 {
@@ -121,7 +120,7 @@ xs550_set_internal_network_uuid()
         local net_uuid=$(xenstore-read "${PRIVATE}/network-uuid" 2>/dev/null)
         if [ -n "${net_uuid}" ] ; then
             logger -t scripts-vif "${bridge} xs-network-uuids ${net_uuid}"
-            echo "-- br-set-external-id \"$bridge\" xs-network-uuids \"${net_uuid}\""
+            echo "-- br-set-external-id $bridge xs-network-uuids ${net_uuid}"
         fi
     else
         # XAPI after 5.5.0 sets the network external ids itself, via ovs-vsctl.
@@ -159,7 +158,7 @@ add_to_bridge()
                local vif_details=$(handle_vswitch_vif_details)
            fi
 
-           $vsctl -- --if-exists del-port $dev -- add-port $bridge $dev $vif_details $(xs550_set_internal_network_uuid)
+           $vsctl -- --if-exists del-port $dev -- add-port $bridge $dev $vif_details $(xs550_set_internal_network_uuid $bridge)
            ;;
     esac
            
@@ -173,7 +172,10 @@ remove_from_bridge()
            # Nothing to do
            ;;
        vswitch)
-           $vsctl del-port $bridge $dev
+            # If ovs-brcompatd is running, it might already have deleted the
+            # port.  Use --if-exists to suppress the error that would otherwise
+            # arise in that case.
+           $vsctl -- --if-exists del-port $dev
            ;;
     esac
 }