diff options
author | Gurucharan Shetty <gshetty@nicira.com> | 2013-05-23 16:14:19 -0700 |
---|---|---|
committer | root <root@cloud-95-121.nicira.com> | 2013-05-24 10:38:57 -0700 |
commit | ede1aa66eca16c812a4349a5aad4131b291f7293 (patch) | |
tree | b46e4f88e3128fe083d2bec841cf2e4e4081c750 /xenserver | |
parent | 12b3586d5743fec767367a9cbc9e04bebda170c4 (diff) | |
download | openvswitch-ede1aa66eca16c812a4349a5aad4131b291f7293.tar.gz |
ovs-xapi-sync: Handle exceptions from XAPI for get_single_bridge_id.
There are possibilities when records disappear underneath ovs-xapi-sync.
In this particular case, when VLAN network was deleted, the corresponding
record in bridge's external_ids:xs_network_ids column was not deleted by
xenserver. In situations like that handle the exceptions cleanly.
Bug #17390.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'xenserver')
-rwxr-xr-x | xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index e14b319b1..ac56d371c 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync @@ -98,13 +98,23 @@ def get_single_bridge_id(bridge_ids, default=None): return default for bridge_id in bridge_ids: - recs = session.xenapi.network.get_all_records_where('field "uuid"="%s"' % bridge_id) - if recs: - pifs = recs.values()[0]['PIFs'] - for pif in pifs: - rec = session.xenapi.PIF.get_record(pif) - if rec['VLAN'] == '-1': - return bridge_id + try: + recs = session.xenapi.network.get_all_records_where(\ + 'field "uuid"="%s"' % bridge_id) + if recs: + pifs = recs.values()[0]['PIFs'] + for pif in pifs: + try: + rec = session.xenapi.PIF.get_record(pif) + if rec['VLAN'] == '-1': + return bridge_id + except XenAPI.Failure: + vlog.warn("Could not find XAPI entry for PIF %s" % pif) + continue + + except XenAPI.Failure: + vlog.warn("Could not find XAPI entry for bridge_id %s" % bridge_id) + continue return default |