Ensure exceptions on the sync function don't kill the agent

There are chances that while running a sync action some unhandled
exception is raised and kills the agent. To avoid this patch is
ensuring any exception raised during the re-sync action is properly
logged and allows the sync actions to continue in the next iterations

Change-Id: Ie1b0ee5fd2ff64cfcbfc948a592f5a9956613247
This commit is contained in:
Luis Tomas Bolivar 2023-02-22 15:48:25 +01:00
parent 5d760e41bb
commit 75212e9259
1 changed files with 4 additions and 1 deletions

View File

@ -58,7 +58,10 @@ class BGPAgent(service.Service, periodic_task.PeriodicTasks,
def sync(self, context):
LOG.info("Running reconciliation loop to ensure routes/rules are "
"in place.")
self.agent_driver.sync()
try:
self.agent_driver.sync()
except Exception as e:
LOG.exception("Unexpected exception while running the sync: %s", e)
def wait(self):
super(BGPAgent, self).wait()