xenserver: Include bridge.*.xs-network-uuids for all networks
authorIan Campbell <Ian.Campbell@citrix.com>
Mon, 5 Oct 2009 15:27:01 +0000 (16:27 +0100)
committerBen Pfaff <blp@nicira.com>
Mon, 5 Oct 2009 16:49:34 +0000 (09:49 -0700)
Previously I advised that only networks which were currently attached to
the host be listed in /etc/ovs-vswitchd.conf. However I've just realised
that this interacts badly with the slightly ugly special case used for
PIF.currently-attached when reading from dbcache instead of talking to
Xapi. This bites on boot when /etc/init.d/management-interface tries to
plug a selection of PIFs which are deemed to be somehow required by
xapi. (not helped by a bug in XenServer 5.7.0 which can cause this list
to be larger than it should be and not internally consistent).

For now I think it prudent to simply list all networks which could
potentially be attached to a given datapath, until I can figure out what
the sane fix is on the XenServer end.

(I think there are two options for a proper fix, either inspect the
current state of the network devices or assume dbcache represents the
desired final state after devices are plugged on boot. I'm leaning
towards the later since the dbcache should indicate the set of PIFs
which were attached on shutdown, which xapi will likely be trying to
replug on boot... Needs more thought though).

xenserver/opt_xensource_libexec_interface-reconfigure

index f29e75b..7b0c9ef 100755 (executable)
@@ -1448,9 +1448,13 @@ def action_up(pif):
 
         for nwpif in db.get_pifs_by_device(db.get_pif_record(pif)['device']):
             rec = db.get_pif_record(nwpif)
-            if nwpif != pif and not rec['currently_attached']:
-                log("Network PIF %s not currently attached (%s)" % (rec['uuid'],pifrec['uuid']))
-                continue
+            
+            # When state is read from dbcache PIF.currently_attached
+            # is always assumed to be false... Err on the side of
+            # listing even detached networks for the time being.
+            #if nwpif != pif and not rec['currently_attached']:
+            #    log("Network PIF %s not currently attached (%s)" % (rec['uuid'],pifrec['uuid']))
+            #    continue
             nwrec = db.get_network_record(rec['network'])
             cfgmod_argv += ['--add=bridge.%s.xs-network-uuids=%s' % (bridge, nwrec['uuid'])]
 
@@ -1514,10 +1518,10 @@ def action_down(pif):
     ifdown(ipdev)
 
     if dp:
-        nw = db.get_pif_record(pif)['network']
-        nwrec = db.get_network_record(nw)
-        cfgmod_argv += ['# deconfigure xs-network-uuids']
-        cfgmod_argv += ['--del-entry=bridge.%s.xs-network-uuids=%s' % (bridge,nwrec['uuid'])]
+        #nw = db.get_pif_record(pif)['network']
+        #nwrec = db.get_network_record(nw)
+        #cfgmod_argv += ['# deconfigure xs-network-uuids']
+        #cfgmod_argv += ['--del-entry=bridge.%s.xs-network-uuids=%s' % (bridge,nwrec['uuid'])]
 
         log("deconfigure ipdev %s on %s" % (ipdev,bridge))
         cfgmod_argv += ["# deconfigure ipdev %s" % ipdev]