From 77ec82f84227f0cc2138f747267ffff0306b4ef7 Mon Sep 17 00:00:00 2001 From: Sachin Bansal Date: Wed, 17 Jun 2015 11:54:52 -0700 Subject: [PATCH] Catch all exceptions in reinit phase In one customer setup, I noticed that ip-fabric network was deleted. When schema transformer tried to delete the corresponding routing instance, it got RefsExistError. We should log and ignore all error during reinit phase to avoid such crashes. Change-Id: I8b284ce24358d429ab2c766e2865bf66c5deb889 Closes-Bug: 1466153 --- src/config/schema-transformer/to_bgp.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/config/schema-transformer/to_bgp.py b/src/config/schema-transformer/to_bgp.py index 36dccb4f0f9..b374cc46941 100644 --- a/src/config/schema-transformer/to_bgp.py +++ b/src/config/schema-transformer/to_bgp.py @@ -2745,10 +2745,9 @@ def reinit(self): if ri.parent_uuid not in vn_id_list: delete = True else: - ri_name = ri.get_fq_name()[-1] # if the RI was for a service chain and service chain no # longer exists, delete the RI - sc_id = VirtualNetworkST._get_service_id_from_ri(ri_name) + sc_id = VirtualNetworkST._get_service_id_from_ri(ri.name) if sc_id and sc_id not in ServiceChain: delete = True else: @@ -2759,6 +2758,11 @@ def reinit(self): ri_obj.delete() except NoIdError: pass + except Exception as e: + _sandesh._logger.error( + "Error while deleting routing instance %s: %s", + ri.get_fq_name_str(), str(e)) + # end for ri sg_list = _vnc_lib.security_groups_list(detail=True, @@ -2787,6 +2791,10 @@ def reinit(self): _vnc_lib.access_control_list_delete(id=acl.uuid) except NoIdError: pass + except Exception as e: + _sandesh._logger.error( + "Error while deleting acl %s: %s", + acl.uuid, str(e)) # end for acl gevent.sleep(0.001)