vswitch: interface-reconfigure: bring down physical interfaces
authorIan Campbell <ian.campbell@citrix.com>
Thu, 25 Feb 2010 16:15:13 +0000 (16:15 +0000)
committerBen Pfaff <blp@nicira.com>
Fri, 26 Feb 2010 17:31:14 +0000 (09:31 -0800)
This should be done when bringing down the last PIF which uses a
datapath in order to account for VLAN PIFs sharing a datapath.

The logic in bring_down() already acounts for this requirement by
clearing the dp variable if the datapath is still required so if we
get as far as deconfiguring that datapath then it is also correct to
bring down the physical devices.

With unit test suite update by Ben Pfaff.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tests/interface-reconfigure.at
xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py

index 66e4052..597a8f1 100644 (file)
@@ -684,6 +684,8 @@ action_down: xenbr2
 /sbin/ifdown xenbr2
 deconfigure ipdev xenbr2 on xenbr2
 deconfigure_bridge: bridge           - xenbr2
+action_down: bring down physical devices - [u'eth2']
+/sbin/ifconfig eth2 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xenbr2
     --if-exists del-br xenbr2
@@ -747,6 +749,8 @@ deconfigure ipdev xapi3 on xenbr3
 deconfigure_bridge: bridge           - xapi3
 action_down: no more masters, bring down slave xenbr3
 deconfigure_bridge: bridge           - xenbr3
+action_down: bring down physical devices - [u'eth3']
+/sbin/ifconfig eth3 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi3
     --if-exists del-br xapi3
@@ -824,6 +828,9 @@ action_down: xapi1
 /sbin/ifdown xapi1
 deconfigure ipdev xapi1 on xapi1
 deconfigure_bridge: bridge           - xapi1
+action_down: bring down physical devices - [u'eth0', u'eth1']
+/sbin/ifconfig eth0 down
+/sbin/ifconfig eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi1
     --if-exists del-br xapi1
@@ -905,6 +912,9 @@ deconfigure ipdev xapi2 on xapi1
 deconfigure_bridge: bridge           - xapi2
 action_down: no more masters, bring down slave xapi1
 deconfigure_bridge: bridge           - xapi1
+action_down: bring down physical devices - [u'eth0', u'eth1']
+/sbin/ifconfig eth0 down
+/sbin/ifconfig eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi2
     --if-exists del-br xapi2
index 0d14251..67636c0 100644 (file)
@@ -434,4 +434,11 @@ class DatapathVswitch(Datapath):
         if dp:
             vsctl_argv += deconfigure_bridge(dp)
 
+            physical_devices = [pif_netdev_name(p) for p in datapath_get_physical_pifs(dp)]
+
+            log("action_down: bring down physical devices - %s" % physical_devices)
+        
+            for p in physical_devices:
+                netdev_down(p)
+
         datapath_modify_config(vsctl_argv)