From 5c2a5c5e794de1dfd68b07e184015fe36eefb649 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Thu, 3 Dec 2020 05:41:08 -0500 Subject: [PATCH] pyocf: add cache detach api Signed-off-by: Michal Mielewczyk --- tests/functional/pyocf/types/cache.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/functional/pyocf/types/cache.py b/tests/functional/pyocf/types/cache.py index 928054b..9644342 100644 --- a/tests/functional/pyocf/types/cache.py +++ b/tests/functional/pyocf/types/cache.py @@ -431,6 +431,21 @@ class Cache: if c.results["error"]: raise OcfError("Attaching cache device failed", c.results["error"]) + def detach_device(self): + self.write_lock() + + c = OcfCompletion([("cache", c_void_p), ("priv", c_void_p), ("error", c_int)]) + + self.owner.lib.ocf_mngt_cache_detach( + self.cache_handle, c, None + ) + + c.wait() + self.write_unlock() + + if c.results["error"]: + raise OcfError("Attaching cache device failed", c.results["error"]) + def load_cache(self, device): self.configure_device(device) c = OcfCompletion([("cache", c_void_p), ("priv", c_void_p), ("error", c_int)])