summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurucharan Shetty <gshetty@nicira.com>2013-05-23 16:14:19 -0700
committerGurucharan Shetty <gshetty@nicira.com>2013-05-24 10:58:26 -0700
commite601782b47fd10cd396ae0a90d527cd37e482dfe (patch)
treecaf6088bcd03de86cf512dd67289e47f80985625
parent3f09392de97c5ce5817a82cb965d450b924cdbfc (diff)
downloadopenvswitch-e601782b47fd10cd396ae0a90d527cd37e482dfe.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>
-rwxr-xr-xxenserver/usr_share_openvswitch_scripts_ovs-xapi-sync24
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