From 1273e9ddfe322d1d61d35329b89b58224ac8e588 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Tue, 26 Oct 2021 15:19:40 +0200 Subject: [PATCH] Fix leaking Volumes and OcfCtx's Signed-off-by: Jan Musial --- tests/functional/pyocf/types/cache.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/functional/pyocf/types/cache.py b/tests/functional/pyocf/types/cache.py index 57bd27f..1b9863e 100644 --- a/tests/functional/pyocf/types/cache.py +++ b/tests/functional/pyocf/types/cache.py @@ -210,7 +210,6 @@ class Cache: ) if status: raise OcfError("Creating cache instance failed", status) - self.owner.caches.append(self) self.mngt_queue = mngt_queue or Queue(self, "mgmt-{}".format(self.get_name())) @@ -224,6 +223,7 @@ class Cache: raise OcfError("Error setting management queue", status) self.started = True + self.owner.caches.append(self) def change_cache_mode(self, cache_mode: CacheMode): self.write_lock() @@ -494,6 +494,7 @@ class Cache: c.wait() self.write_unlock() + self.device = None if c.results["error"]: raise OcfError("Attaching cache device failed", c.results["error"]) @@ -714,9 +715,10 @@ class Cache: self.mngt_queue.put() del self.io_queues[:] - self.started = False self.write_unlock() + self.device = None + self.started = False self.owner.caches.remove(self)