From 22936a9aa6b795ed1bf1ba46280a36014935855f Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sun, 5 Jan 2020 16:58:07 +0000 Subject: [PATCH] CNI: handle delete when db record is missing We should let DEL request to succeed even if the DB record is not found in database. In this case, we cannot retrieve the vif thus ignoring the vif disconnect step. Change-Id: I8207d7b624af17ddf002affb626cc4f1d8bdabec --- zun/cni/plugins/zun_cni_registry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zun/cni/plugins/zun_cni_registry.py b/zun/cni/plugins/zun_cni_registry.py index 8efe450df..29d794946 100644 --- a/zun/cni/plugins/zun_cni_registry.py +++ b/zun/cni/plugins/zun_cni_registry.py @@ -99,7 +99,13 @@ class ZunCNIRegistryPlugin(object): return except KeyError: pass - self._do_work(params, b_base.disconnect) + + try: + self._do_work(params, b_base.disconnect) + except exception.ContainerNotFound: + LOG.warning('Capsule is not found in DB. Ignoring.') + pass + # NOTE(ndesh): We need to lock here to avoid race condition # with the deletion code in the watcher to ensure that # we delete the registry entry exactly once