From 40043044700de567251236d2e4afa89e02b9d1c2 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 16 Jun 2011 15:02:50 -0700 Subject: [PATCH] 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 --- .../usr_share_openvswitch_scripts_ovs-xapi-sync | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index d1ccc6f70..ef10ce792 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: -- 2.45.2