From 161792daa1bfc53a44049f6912a74b4e7673d50b Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 6 Aug 2015 15:52:34 -0700 Subject: [PATCH] Remove terminated image/instance delete threads When the separate image and instance delete threads were added for periodic cleanup of leaked images and instances, the same anti-duplication mechanism used for the periodic cleanup of nodes was used: an dictionary of thread objects keyed by the object being deleted. However, the cleanup of those delete threads was neglected, meaning that after those threads exited, if the object persisted, nodepool would never try to delete it again. This change adds the missing cleanup code. Change-Id: Iac4049d265e23a7eae1b2917181de3c35fb6359d --- nodepool/nodepool.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nodepool/nodepool.py b/nodepool/nodepool.py index ddbe8b565..e169ec8a5 100644 --- a/nodepool/nodepool.py +++ b/nodepool/nodepool.py @@ -2353,6 +2353,14 @@ class NodePool(threading.Thread): if not t.isAlive(): del self._delete_threads[k] + for k, t in self._image_delete_threads.items()[:]: + if not t.isAlive(): + del self._image_delete_threads[k] + + for k, t in self._instance_delete_threads.items()[:]: + if not t.isAlive(): + del self._instance_delete_threads[k] + node_ids = [] image_ids = [] dib_image_ids = []