Log caught exceptions while deleting a router

Change-Id: I2c270f1eebf4f3c0d2cecdef457efc626e503975
Closes-Bug: #1446349
This commit is contained in:
Assaf Muller 2015-04-20 15:15:34 -04:00
parent d7d30bf659
commit d9e3352f9a
1 changed files with 14 additions and 4 deletions

View File

@ -317,6 +317,17 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
# TODO(Carl) This is a hook in to fwaas. It should be cleaned up.
self.process_router_add(ri)
def _safe_router_removed(self, router_id):
"""Try to delete a router and return True if successful."""
try:
self._router_removed(router_id)
except Exception:
LOG.exception(_LE('Error while deleting router %s'), router_id)
return False
else:
return True
def _router_removed(self, router_id):
ri = self.router_info.get(router_id)
if ri is None:
@ -439,9 +450,8 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
router = routers[0]
if not router:
try:
self._router_removed(update.id)
except Exception:
removed = self._safe_router_removed(update.id)
if not removed:
# TODO(Carl) Stop this fullsync non-sense. Just retry this
# one router by sticking the update at the end of the queue
# at a lower priority.
@ -456,7 +466,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
if router['id'] in self.router_info:
LOG.error(_LE("Removing incompatible router '%s'"),
router['id'])
self._router_removed(router['id'])
self._safe_router_removed(router['id'])
except Exception:
msg = _LE("Failed to process compatible router '%s'")
LOG.exception(msg, update.id)