pyocf: add cache detach api

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-12-03 05:41:08 -05:00
parent 93318696cd
commit 5c2a5c5e79

View File

@ -431,6 +431,21 @@ class Cache:
if c.results["error"]: if c.results["error"]:
raise OcfError("Attaching cache device failed", 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): def load_cache(self, device):
self.configure_device(device) self.configure_device(device)
c = OcfCompletion([("cache", c_void_p), ("priv", c_void_p), ("error", c_int)]) c = OcfCompletion([("cache", c_void_p), ("priv", c_void_p), ("error", c_int)])