[ovs-dev] [PATCH 1/1] xenserver: Fix iteration of dictionary

Rob Hoes gigamuffin at gmail.com
Wed Feb 15 17:17:25 UTC 2012


From: Dominic Curran <dominic.curran at citrix.com>

Fix bug in commit 3249bb907a1dab9b0

Incorrectly assume that get_all_records_where() returned a list.
It infact returns a disctionary and the list iteratory needs to change
to account for this.
Thanks to Nicira for pointing this out.

NIC-454.

Signed-off-by: Rob Hoes <rob.hoes at citrix.com>
Reported-by: David Tsai <dtsai at nicira.com>
Signed-off-by: Dominic Curran <Dominic.curran at citrix.com>
---
 .../etc_xapi.d_plugins_openvswitch-cfg-update      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
index a9a10e8..ef4d11a 100755
--- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
+++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
@@ -100,7 +100,7 @@ def update(session, args):
     pool_mgmt_macs = {}
     if new_controller:
         recs = session.xenapi.PIF.get_all_records_where('field "management"="true"')
-        for rec in recs:
+        for rec in recs.itervalues():
             pool_mgmt_macs[rec.get('MAC')] = rec.get('device')
 
     dib_changed = False
-- 
1.7.5.4




More information about the dev mailing list