From: Ian Campbell Date: Thu, 25 Feb 2010 16:15:13 +0000 (+0000) Subject: vswitch: interface-reconfigure: bring down physical interfaces X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df9a459ab60259b88610ac781889f69b73fbffad;p=openvswitch vswitch: interface-reconfigure: bring down physical interfaces 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 --- diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at index 66e40521..597a8f1b 100644 --- a/tests/interface-reconfigure.at +++ b/tests/interface-reconfigure.at @@ -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 diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py index 0d14251b..67636c0a 100644 --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py @@ -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)