Skip to content

Commit

Permalink
Gracefully handle duplicate delete requests.
Browse files Browse the repository at this point in the history
This code change is to handle any gracefully handle duplicate delete requests
sent by external entities, in this case service monitor.
This code change will log and handle the key not found excpetion and proceed.

The service monitor, sending  duplicate deletes is tracked by bug: 1636932

Change-Id: I606561ca0e3c570713b41c196325180a16f96987
closes-bug: #1635901
  • Loading branch information
dineshb-jnpr committed Oct 26, 2016
1 parent 5bcd008 commit c1678b2
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/config/api-server/vnc_cfg_ifmap.py
Expand Up @@ -575,17 +575,28 @@ def _build_request(self, id1_name, id2_name, meta_list, delete=False):
def _delete_id_self_meta(self, self_imid, meta_name):
mapclient = self._mapclient
contrail_metaname = 'contrail:' + meta_name if meta_name else None
del_str = self._build_request(self_imid, 'self', [contrail_metaname],
del_str = self._build_request(self_imid, 'self', [contrail_metaname],
True)
self._publish_to_ifmap_enqueue('delete', del_str)

# del meta from cache and del id if this was last meta
if meta_name:
del self._id_to_metas[self_imid][meta_name]
if not self._id_to_metas[self_imid]:
try:

# del meta from cache and del id if this was last meta
if meta_name:
del self._id_to_metas[self_imid][meta_name]
if not self._id_to_metas[self_imid]:
del self._id_to_metas[self_imid]
else:
del self._id_to_metas[self_imid]
else:
del self._id_to_metas[self_imid]

except KeyError:
# Case of delete received for an id which we do not know about.
# Could be a case of duplicate delete.
# There is nothing for us to do here. Just log and proceed.
msg = "Delete received for unknown imid(%s) meta_name(%s)." % \
(self_imid, meta_name)
self.config_log(msg, level=SandeshLevel.SYS_DEBUG)

# end _delete_id_self_meta

def _delete_id_pair_meta_list(self, id1, meta_list):
Expand Down

0 comments on commit c1678b2

Please sign in to comment.