Merge "Log caught exceptions while deleting a router"

This commit is contained in:
Jenkins 2015-04-21 04:10:55 +00:00 committed by Gerrit Code Review
commit 5171544191
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)