Who designs these APIs, anyway? quentin
authorQuentin Smith <quentin@mit.edu>
Sun, 2 Jan 2011 08:00:39 +0000 (03:00 -0500)
committerQuentin Smith <quentin@mit.edu>
Sun, 2 Jan 2011 08:00:39 +0000 (03:00 -0500)
debian/changelog
vif-invirtroute

index 0f11f33..08d2739 100644 (file)
@@ -1,3 +1,11 @@
+invirt-xen-config (0.0.35) unstable; urgency=low
+
+  * Unconditionally try to remove a bridge. Apparently Xen doesn't tell
+    you in an "offline" command whether there was a tap interface or not,
+    so we have to assume there was and try to get rid of the bridge.
+
+ -- Quentin Smith <quentin@mit.edu>  Sun, 02 Jan 2011 03:00:27 -0500
+
 invirt-xen-config (0.0.34) unstable; urgency=low
 
   * The kernel fails to issue a udev event when a paravirtualized guest
index e8b5eb8..c24741e 100755 (executable)
@@ -33,15 +33,16 @@ main_ip=$(dom0_ip)
 dev=${dev:-${vif}}
 intfname=${dev}
 
+brname=dom${vif#vif}
 if [ ${dev} != ${vif} ]; then
     # This is an HVM and it has two interfaces, so we'll set up a bridge.
-    brname=dom${vif#vif}
+    dobridge=yes
     intfname=${brname}
 fi
 
 case "$command" in
     online)
-       if [ $brname ]; then
+       if [ $dobridge ]; then
             create_bridge ${brname}
             setup_bridge_port ${dev}
             setup_bridge_port ${vif}
@@ -57,11 +58,9 @@ case "$command" in
         cmdprefix=''
         ;;
     offline)
-       if [ $brname ]; then
-            do_without_error brctl delif ${brname} ${vif}
-            do_without_error brctl delif ${brname} ${dev}
-            do_without_error ifconfig ${brname} down
-       fi
+        do_without_error brctl delif ${brname} ${vif}
+        do_without_error brctl delif ${brname} ${dev}
+        do_without_error ifconfig ${brname} down
         ipcmd='del'
         cmdprefix='do_without_error'
         ;;
@@ -86,7 +85,7 @@ if [  ${vif_type} != "ioemu"  -o  x${qemu_online} = xyes ] ; then
     fi
 fi
 
-if [[ "$command" == "offline" && -n "$brname" ]]
+if [ "$command" == "offline" ]
 then
     do_without_error brctl delbr ${brname}
 fi