From 8e1fe9a263a868fcc0849af373a2f5a0a23a6811 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Mon, 6 Jun 2022 17:10:33 +0200 Subject: [PATCH] pyocf: generic open() for exported object volumes Signed-off-by: Adam Rutkowski --- tests/functional/pyocf/types/volume_cache.py | 4 ++-- tests/functional/pyocf/types/volume_core.py | 4 ++-- tests/functional/pyocf/types/volume_exp_obj.py | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/functional/pyocf/types/volume_cache.py b/tests/functional/pyocf/types/volume_cache.py index 7c6199e..5865ec1 100644 --- a/tests/functional/pyocf/types/volume_cache.py +++ b/tests/functional/pyocf/types/volume_cache.py @@ -20,8 +20,8 @@ class CacheVolume(ExpObjVolume): if open: self.open() - def open(self): - return Volume.open(self.lib.ocf_cache_get_front_volume(self.cache.cache_handle), self) + def get_c_handle(self): + return self.cache.get_c_front_volume() def md5(self): out = self.cache.get_conf() diff --git a/tests/functional/pyocf/types/volume_core.py b/tests/functional/pyocf/types/volume_core.py index 1de5098..02a7695 100644 --- a/tests/functional/pyocf/types/volume_core.py +++ b/tests/functional/pyocf/types/volume_core.py @@ -17,8 +17,8 @@ class CoreVolume(ExpObjVolume): if open: self.open() - def open(self): - return Volume.s_open(self.lib.ocf_core_get_front_volume(self.core.handle), self) + def get_c_handle(self): + return self.core.get_c_front_volume() def md5(self): return self._exp_obj_md5(4096) diff --git a/tests/functional/pyocf/types/volume_exp_obj.py b/tests/functional/pyocf/types/volume_exp_obj.py index 984e5b3..9d92b5e 100644 --- a/tests/functional/pyocf/types/volume_exp_obj.py +++ b/tests/functional/pyocf/types/volume_exp_obj.py @@ -113,6 +113,10 @@ class ExpObjVolume(Volume): return read_buffer_all.md5() + def open(self): + handle = self.get_c_handle() + return Volume.s_open(handle, self) + lib = OcfLib.getInstance() lib.ocf_volume_get_max_io_size.argtypes = [c_void_p]