+
+ # vNetManager needs to know the network UUID(s) associated with
+ # each datapath. Normally interface-reconfigure adds them, but
+ # interface-reconfigure never gets called for internal networks
+ # (xapi does the addbr ioctl internally), so we have to do it
+ # here instead for internal networks. This is only acceptable
+ # because xapi is lazy about creating internal networks: it
+ # only creates one just before it adds the first vif to it.
+ # There may still be a brief delay between the initial
+ # ovs-vswitchd connection to vNetManager and setting this
+ # configuration variable, but vNetManager can tolerate that.
+ if len(net_rec['PIFs']) == 0:
+ key = 'bridge.%s.xs-network-uuids' % net_rec['bridge']
+ value = net_rec['uuid']
+ sys.stdout.write('--del-match=%s=* ' % key)
+ sys.stdout.write('--add=%s=%s ' % (key, value))