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'])]
cfgmod_argv += ['--add=vlan.%s.tag=%s' % (ipdev, pifrec['VLAN'])]
cfgmod_argv += ['--add=iface.%s.internal=true' % (ipdev)]
cfgmod_argv += ['--add=iface.%s.fake-bridge=true' % (ipdev)]
- if not os.path.exists(vswitch_state_dir):
- os.mkdir(vswitch_state_dir)
- br = ConfigurationFile("br-%s" % ipdev, vswitch_state_dir)
- br.write("VLAN_SLAVE=%s\n" % bridge)
- br.write("VLAN_VID=%s\n" % pifrec['VLAN'])
- br.close()
- f.attach_child(br)
- else:
- br = ConfigurationFile("br-%s" % ipdev, vswitch_state_dir)
- br.unlink()
- f.attach_child(br)
# Apply updated configuration.
try:
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]