From 75212e925938cd5d2d7affd48b3ba6c73854686e Mon Sep 17 00:00:00 2001 From: Luis Tomas Bolivar Date: Wed, 22 Feb 2023 15:48:25 +0100 Subject: [PATCH] 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 --- ovn_bgp_agent/agent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ovn_bgp_agent/agent.py b/ovn_bgp_agent/agent.py index c62e717d..d5892129 100644 --- a/ovn_bgp_agent/agent.py +++ b/ovn_bgp_agent/agent.py @@ -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()