[ovs-dev] [PATCH 04/12] xenserver: Fix bringing up VLAN PIFs.
Ben Pfaff
blp at nicira.com
Mon Feb 22 16:42:40 PST 2010
In configure_datapath(), bringing up a VLAN PIF's datapath is no different
from bringing up a non-VLAN PIF's datapath, but the code was making
unnecessary distinctions. Also, the test
if parent and datapath:
did not work at all, because there was no variable named 'datapath' in
scope and no obvious source of one.
In preconfigure(), it then becomes necessary to create a VLAN bridge for a
VLAN PIF, in a straightforward way.
---
...ensource_libexec_InterfaceReconfigureVswitch.py | 34 ++++++++++---------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
index f777b17..cd66e9e 100644
--- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
+++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
@@ -171,12 +171,12 @@ def datapath_modify_config(commands):
# Toplevel Datapath Configuration.
#
-def configure_datapath(pif, parent=None, vlan=None):
- """Bring up the datapath configuration for PIF.
-
- Should be careful not to glitch existing users of the datapath, e.g. other VLANs etc.
-
- Should take care of tearing down other PIFs which encompass common physical devices.
+def configure_datapath(pif):
+ """Bring up the configuration for 'pif', which must not be a VLAN PIF, by:
+ - Tearing down other PIFs that use the same physical devices as 'pif'.
+ - Ensuring that 'pif' itself is set up.
+ - *Not* tearing down any PIFs that are stacked on top of 'pif' (i.e. VLANs
+ on top of 'pif'.
Returns a tuple containing
- A list containing the necessary vsctl command line arguments
@@ -260,10 +260,7 @@ def configure_datapath(pif, parent=None, vlan=None):
vsctl_argv += ['# deconfigure physical port %s' % dev]
vsctl_argv += datapath_deconfigure_physical(dev)
- if parent and datapath:
- vsctl_argv += ['--', '--may-exist', 'add-br', bridge, parent, vlan]
- else:
- vsctl_argv += ['--', '--may-exist', 'add-br', bridge]
+ vsctl_argv += ['--', '--may-exist', 'add-br', bridge]
if len(physical_devices) > 1:
vsctl_argv += ['# deconfigure bond %s' % pif_netdev_name(pif)]
@@ -329,15 +326,20 @@ class DatapathVswitch(Datapath):
dprec = db().get_pif_record(self._dp)
ipdev = self._ipdev
- bridge = pif_bridge_name(self._dp)
- if pif_is_vlan(self._pif):
- datapath = pif_datapath(self._pif)
- c,e = configure_datapath(self._dp, datapath, pifrec['VLAN'])
- else:
- c,e = configure_datapath(self._dp)
+ c,e = configure_datapath(self._dp)
+ bridge = pif_bridge_name(self._pif)
vsctl_argv += c
extra_ports += e
+ if pif_is_vlan(self._pif):
+ # XXX this is only needed on XS5.5, because XAPI misguidedly
+ # creates the fake bridge (via bridge ioctl) before it calls us.
+ vsctl_argv += ['--', '--if-exists', 'del-br', bridge]
+
+ # configure_datapath() set up the underlying datapath bridge.
+ # Stack a VLAN bridge on top of it.
+ vsctl_argv += ['--', '--may-exist', 'add-br',
+ bridge, pif_bridge_name(self._dp), pifrec['VLAN']]
xs_network_uuids = []
for nwpif in db().get_pifs_by_device(db().get_pif_record(self._pif)['device']):
rec = db().get_pif_record(nwpif)
--
1.6.6.1
More information about the dev
mailing list