2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 07:15:17 +00:00

xenserver: Fix bringing up VLAN PIFs.

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.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2010-02-22 13:08:10 -08:00
parent 96c7918c40
commit d77ffabfbc

View File

@@ -155,12 +155,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
@@ -244,10 +244,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)]
@@ -313,15 +310,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)