Merge "Improve exception handling in _process_router_update()" into stable/juno

This commit is contained in:
Jenkins 2015-04-01 21:20:46 +00:00 committed by Gerrit Code Review
commit 618824201c
2 changed files with 36 additions and 1 deletions

View File

@ -1860,7 +1860,13 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
self._router_removed(update.id)
continue
self._process_routers([router])
try:
self._process_routers([router])
except Exception:
msg = _("Failed to process router '%s'")
LOG.exception(msg, update.id)
self.fullsync = True
continue
LOG.debug("Finished a router update for %s", update.id)
rp.fetched_and_processed(update.timestamp)

View File

@ -1848,6 +1848,35 @@ class TestBasicRouterOperations(base.BaseTestCase):
self.assertEqual(['1234'], agent._router_ids())
self.assertFalse(agent._clean_stale_namespaces)
def test_process_routers_update_rpc_timeout_on_get_routers(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
agent.fullsync = False
agent._process_routers = mock.Mock()
self.plugin_api.get_routers.side_effect = (
messaging.MessagingTimeout)
agent._queue = mock.Mock()
update = mock.Mock()
update.router = None
agent._queue.each_update_to_next_router.side_effect = [
[(None, update)]]
agent._process_router_update()
self.assertTrue(agent.fullsync)
self.assertFalse(agent._process_routers.called)
def test_process_routers_update_rpc_timeout_on_get_ext_net(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
agent.fullsync = False
agent._process_routers = mock.Mock()
agent._process_routers.side_effect = (
messaging.MessagingTimeout)
agent._queue = mock.Mock()
agent._queue.each_update_to_next_router.side_effect = [
[(None, mock.Mock())]]
agent._process_router_update()
self.assertTrue(agent.fullsync)
def test_process_routers_with_no_ext_net_in_conf(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
self.plugin_api.get_external_network_id.return_value = 'aaa'