From d2bb51ca2529ef1ce8f8ffa412ac76778e6fd829 Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Wed, 16 Nov 2011 10:07:03 -0800 Subject: [PATCH] bug #891267 : for XS, grab iface-id from XAPI directly if needed. The version of OVS that ships with XenServer by default does not include the script to automatically sync the XAPI other_config:nicira-iface-id field of a VIF with the external_ids:iface-id in the OVS interfaces table. Thus, make the agent grab the value directly from XAPI if iface-id is not already populated. Change-Id: Id01d9da1761016bcd983ad06621c62e94b2445c1 --- .../openvswitch/agent/ovs_quantum_agent.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/openvswitch-plugin/lib/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/plugins/openvswitch-plugin/lib/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py index 2d5376f51..398b8b994 100755 --- a/plugins/openvswitch-plugin/lib/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py +++ b/plugins/openvswitch-plugin/lib/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py @@ -130,17 +130,34 @@ class OVSBridge: def get_port_stats(self, port_name): return self.db_get_map("Interface", port_name, "statistics") + def get_xapi_iface_id(self, xs_vif_uuid): + return self.run_cmd( + ["xe", + "vif-param-get", + "param-name=other-config", + "param-key=nicira-iface-id", + "uuid=%s" % xs_vif_uuid]).strip() + # returns a VIF object for each VIF port def get_vif_ports(self): edge_ports = [] port_names = self.get_port_name_list() for name in port_names: external_ids = self.db_get_map("Interface", name, "external_ids") + ofport = self.db_get_val("Interface", name, "ofport") if "iface-id" in external_ids and "attached-mac" in external_ids: - ofport = self.db_get_val("Interface", name, "ofport") p = VifPort(name, ofport, external_ids["iface-id"], external_ids["attached-mac"], self) edge_ports.append(p) + elif "xs-vif-uuid" in external_ids and \ + "attached-mac" in external_ids: + # if this is a xenserver and iface-id is not automatically + # synced to OVS from XAPI, we grab it from XAPI directly + iface_id = self.get_xapi_iface_id(external_ids["xs-vif-uuid"]) + p = VifPort(name, ofport, iface_id, + external_ids["attached-mac"], self) + edge_ports.append(p) + return edge_ports -- 2.45.2