Although this change removes a broad exception from
periodic_sync_routers_task (neutron.agent.l3_agent), the
implementation still ensures if an exception --caught or uncaught --
prevents a call to the method to disable the fullsync, then the next
call to the method will perform a fullsync again.
Author: Cedric Brandily <zzelle@gmail.com>
Co-Authored-By: Carl Baldwin <carl.baldwin@hp.com>
Change-Id: I6281886f3334100a18952578250c8154a0ed15a9
if not self.fullsync:
return
+ # self.fullsync is True at this point. If an exception -- caught or
+ # uncaught -- prevents setting it to False below then the next call
+ # to periodic_sync_routers_task will re-enter this code and try again.
+
# Capture a picture of namespaces *before* fetching the full list from
# the database. This is important to correctly identify stale ones.
namespaces = set()
except messaging.MessagingException:
LOG.exception(_LE("Failed synchronizing routers due to RPC error"))
- self.fullsync = True
- except Exception:
- LOG.exception(_LE("Failed synchronizing routers"))
- self.fullsync = True
else:
LOG.debug('Processing :%r', routers)
for r in routers:
def test_periodic_sync_routers_task_raise_exception(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
- self.plugin_api.get_routers.side_effect = Exception()
+ self.plugin_api.get_routers.side_effect = ValueError()
with mock.patch.object(agent, '_cleanup_namespaces') as f:
- agent.periodic_sync_routers_task(agent.context)
+ self.assertRaises(ValueError, agent.periodic_sync_routers_task,
+ agent.context)
+ self.assertTrue(agent.fullsync)
self.assertFalse(f.called)
def test_periodic_sync_routers_task_call_clean_stale_namespaces(self):