Skip to content

Commit

Permalink
ovs-xapi-sync: Handle exceptions from XAPI for get_single_bridge_id.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
shettyg authored and root committed May 24, 2013
1 parent 12b3586 commit ede1aa6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ede1aa6

Please sign in to comment.