From: Ethan Jackson Date: Thu, 16 Jun 2011 22:02:50 +0000 (-0700) Subject: xenserver: Give tap devices iface-ids. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40043044700de567251236d2e4afa89e02b9d1c2;p=openvswitch xenserver: Give tap devices iface-ids. In some cases XenServer will give a virtual machine a tap device in addition to its usual vif. These tap devices need iface-ids so that controllers can figure out which vif they are related to. Signed-off-by: Ethan Jackson --- diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index d1ccc6f7..ef10ce79 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync @@ -99,7 +99,7 @@ def get_bridge_id(br_name, default=None): # "nicira-iface-id" key in the "other_config" field of the VIF # record of XAPI. def get_iface_id(if_name, xs_vif_uuid): - if not if_name.startswith("vif"): + if not if_name.startswith("vif") and not if_name.startswith("tap"): # Treat whatever was passed into 'xs_vif_uuid' as a default # value for non-VIFs. return xs_vif_uuid @@ -297,6 +297,17 @@ def main(argv): new_interfaces[name] = {"xs-vif-uuid": xs_vif_uuid, "iface-id": iface_id} + #Tap devices take their xs-vif-uuid from their corresponding vif + for name in new_interfaces: + if not name.startswith("tap"): + continue + + vif = name.replace("tap", "vif", 1) + + if vif in new_interfaces: + xs_vif_uuid = new_interfaces[vif]["xs-vif-uuid"] + new_interfaces[name]["xs-vif-uuid"] = xs_vif_uuid + if bridges != new_bridges: for name,ids in new_bridges.items(): if name not in bridges: