X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=xenserver%2Fusr_share_openvswitch_scripts_ovs-xapi-sync;h=a776c0084f1d3a68c05311a984530fed417a9270;hb=HEAD;hp=583356c366e0d977bd08c5e341d1d7da188e9bc7;hpb=bdca6c4b56b9951b95c02f1fc13cbc78b16eee28;p=cascardo%2Fovs.git diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index 583356c36..a776c0084 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync @@ -34,6 +34,7 @@ import ovs.daemon import ovs.db.idl import ovs.unixctl import ovs.unixctl.server +import six vlog = ovs.vlog.Vlog("ovs-xapi-sync") session = None @@ -67,7 +68,7 @@ def init_session(): try: session = XenAPI.xapi_local() session.xenapi.login_with_password("", "") - except XenAPI.Failure, e: + except XenAPI.Failure as e: session = None vlog.warn("Couldn't login to XAPI (%s)" % e) return False @@ -81,9 +82,10 @@ def get_network_by_bridge(br_name): " XAPI session could not be initialized" % br_name) return None - recs = session.xenapi.network.get_all_records_where('field "bridge"="%s"' % br_name) + recs = session.xenapi.network.get_all_records_where( + 'field "bridge"="%s"' % br_name) if len(recs) > 0: - return recs.values()[0] + return next(six.itervalues(recs)) return None @@ -267,7 +269,7 @@ def main(): while True: unixctl_server.run() if exiting: - break; + break idl.run() if not xapi_down and not flush_cache and seqno == idl.change_seqno: @@ -293,7 +295,7 @@ def main(): txn = ovs.db.idl.Transaction(idl) new_bridges = {} - for row in idl.tables["Bridge"].rows.itervalues(): + for row in six.itervalues(idl.tables["Bridge"].rows): bridge_id = bridges.get(row.name) if bridge_id is None: # Configure the new bridge. @@ -318,12 +320,12 @@ def main(): bridges = new_bridges iface_by_name = {} - for row in idl.tables["Interface"].rows.itervalues(): + for row in six.itervalues(idl.tables["Interface"].rows): iface_by_name[row.name] = row new_iface_ids = {} new_vm_ids = {} - for row in idl.tables["Interface"].rows.itervalues(): + for row in six.itervalues(idl.tables["Interface"].rows): # Match up paired vif and tap devices. if row.name.startswith("vif"): vif = row