From d9e3352f9a7df6e7bc571ca1696a1ef4ca716654 Mon Sep 17 00:00:00 2001 From: Assaf Muller Date: Mon, 20 Apr 2015 15:15:34 -0400 Subject: [PATCH] Log caught exceptions while deleting a router Change-Id: I2c270f1eebf4f3c0d2cecdef457efc626e503975 Closes-Bug: #1446349 --- neutron/agent/l3/agent.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py index 058b9a9d7..2c1c1696e 100644 --- a/neutron/agent/l3/agent.py +++ b/neutron/agent/l3/agent.py @@ -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) -- 2.45.2