Replace the get_record() for network references which caused as many
slave-to-master calls as there are Network records plus one.
The get_all_records_where() call gets exactly what is needed with a single
call.

Signed-off-by: Rob Hoes <rob.h...@citrix.com>
Acked-by: Dominic Curran <dominic.cur...@citrix.com>
---
 .../usr_share_openvswitch_scripts_ovs-xapi-sync    |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync 
b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
index 5083bbd..cb35e7a 100755
--- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
+++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
@@ -82,10 +82,9 @@ def get_network_by_bridge(br_name):
                 " XAPI session could not be initialized" % br_name)
         return None
 
-    for n in session.xenapi.network.get_all():
-        rec = session.xenapi.network.get_record(n)
-        if rec['bridge'] == br_name:
-            return rec
+    recs = session.xenapi.network.get_all_records_where('field "bridge"="%s"' 
% br_name)
+    if len(recs) > 0:
+        return recs.values()[0]
 
     return None
 
-- 
1.7.5.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to