# HG changeset patch # User Ben Pfaff # Date 1278595551 -3600 # Node ID 0c79ddaff67b01b92f63aa960f1a1062bbf68757 # Parent 28ddf8ad939a61b686e98d7d711af2ae9d4bbbe3 [PATCH] xenserver: Fix bringing up VLAN PIFs. >From d77ffabfbcf9eb04b7e69ff6b34e12f000d314ee Mon Sep 17 00:00:00 2001 Date: Mon, 22 Feb 2010 13:08:10 -0800 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 Signed-off-by: Ian Campbell --- ...ensource_libexec_InterfaceReconfigureVswitch.py | 34 ++++++++++--------- 1 files changed, 18 insertions(+), 16 deletions(-) diff -r 28ddf8ad939a -r 0c79ddaff67b scripts/InterfaceReconfigureVswitch.py --- a/scripts/InterfaceReconfigureVswitch.py Thu Jul 08 14:25:51 2010 +0100 +++ b/scripts/InterfaceReconfigureVswitch.py Thu Jul 08 14:25:51 2010 +0100 @@ -155,12 +155,12 @@ # 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 @@ 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 @@ 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)