X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xenserver%2Froot_vswitch_scripts_dump-vif-details;h=b0ceb4054fe05033f7810770071b55e22008d8be;hb=e3951e76bcb6b65b5b4905afce9e2584909ac484;hp=2e9aa0391023559f91d79093cc0cd785dde6c7ef;hpb=3570ee9844655d02eb365deda907b7c6295788ae;p=openvswitch diff --git a/xenserver/root_vswitch_scripts_dump-vif-details b/xenserver/root_vswitch_scripts_dump-vif-details index 2e9aa039..b0ceb405 100755 --- a/xenserver/root_vswitch_scripts_dump-vif-details +++ b/xenserver/root_vswitch_scripts_dump-vif-details @@ -32,7 +32,8 @@ def dump_vif_info(domid, devid, vif_ref): net_rec = session.xenapi.network.get_record(vif_rec["network"]) vm_rec = session.xenapi.VM.get_record(vif_rec["VM"]) - sys.stdout.write('--add=port.vif%s.%s.network-uuid=%s ' + # Data to allow vNetManager to associate VIFs with xapi data + sys.stdout.write('--add=port.vif%s.%s.net-uuid=%s ' % (domid, devid, net_rec["uuid"])) sys.stdout.write('--add=port.vif%s.%s.vif-mac=%s ' % (domid, devid, vif_rec["MAC"])) @@ -40,6 +41,22 @@ def dump_vif_info(domid, devid, vif_ref): % (domid, devid, vif_rec["uuid"])) sys.stdout.write('--add=port.vif%s.%s.vm-uuid=%s ' % (domid, devid, vm_rec["uuid"])) + + # 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)) finally: session.xenapi.session.logout()