From 047b276fc8c1636af60c51f876138cfe4db91108 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 26 Mar 2025 11:35:29 +0100 Subject: [PATCH] pyocf: API for detaching core Signed-off-by: Michal Mielewczyk --- tests/functional/pyocf/types/core.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/functional/pyocf/types/core.py b/tests/functional/pyocf/types/core.py index d774ba1..9cce29f 100644 --- a/tests/functional/pyocf/types/core.py +++ b/tests/functional/pyocf/types/core.py @@ -1,6 +1,6 @@ # # Copyright(c) 2019-2022 Intel Corporation -# Copyright(c) 2024 Huawei Technologies +# Copyright(c) 2024-2025 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # @@ -182,6 +182,17 @@ class Core: if c.results["error"]: raise OcfError("Couldn't flush cache", c.results["error"]) + def detach(self): + self.cache.write_lock() + + c = OcfCompletion([("priv", c_void_p), ("error", c_int)]) + self.cache.owner.lib.ocf_mngt_cache_detach_core(self.handle, c, None) + c.wait() + self.cache.write_unlock() + + if c.results["error"]: + raise OcfError("Couldn't detach core", c.results["error"]) + def reset_stats(self): lib.ocf_core_stats_initialize(self.handle) @@ -207,3 +218,5 @@ lib.ocf_core_stats_initialize.argtypes = [c_void_p] lib.ocf_core_stats_initialize.restype = c_void_p lib.ocf_mngt_core_flush.argtypes = [c_void_p, c_void_p, c_void_p] lib.ocf_mngt_core_flush.restype = c_void_p +lib.ocf_mngt_cache_detach_core.argtypes = [c_void_p, c_void_p, c_void_p] +lib.ocf_mngt_cache_detach_core.restype = c_void_p