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
This commit is contained in:
Hongbin Lu 2020-01-05 16:58:07 +00:00
parent 2bf646e9bd
commit 22936a9aa6

View File

@ -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