diff --git a/tests/functional/pyocf/types/cache.py b/tests/functional/pyocf/types/cache.py index 1b9863e..dfa5ea6 100644 --- a/tests/functional/pyocf/types/cache.py +++ b/tests/functional/pyocf/types/cache.py @@ -570,7 +570,7 @@ class Cache: def write_unlock(self): self.owner.lib.ocf_mngt_cache_unlock(self.cache_handle) - def add_core(self, core: Core): + def add_core(self, core: Core, try_add=False): self.write_lock() c = OcfCompletion( @@ -582,8 +582,11 @@ class Cache: ] ) + cfg = core.get_cfg() + cfg._try_add = try_add + self.owner.lib.ocf_mngt_cache_add_core( - self.cache_handle, byref(core.get_cfg()), c, None + self.cache_handle, byref(cfg), c, None ) c.wait() diff --git a/tests/functional/pyocf/types/core.py b/tests/functional/pyocf/types/core.py index 9e1f663..a862d7c 100644 --- a/tests/functional/pyocf/types/core.py +++ b/tests/functional/pyocf/types/core.py @@ -19,6 +19,9 @@ from ctypes import ( cast, byref, create_string_buffer, + sizeof, + memmove, + pointer, ) from datetime import timedelta @@ -90,7 +93,10 @@ class Core: return c def get_cfg(self): - return self.cfg + config_copy = CoreConfig() + memmove(pointer(config_copy), pointer(self.cfg), sizeof(config_copy)) + + return config_copy def get_handle(self): return self.handle