diff --git a/tests/functional/pyocf/types/volume.py b/tests/functional/pyocf/types/volume.py index d82ed1c..05cdfd9 100644 --- a/tests/functional/pyocf/types/volume.py +++ b/tests/functional/pyocf/types/volume.py @@ -152,8 +152,7 @@ class Volume: @VolumeOps.CLOSE def _close(ref): volume = Volume.get_instance(ref) - volume.close() - volume.opened = False + Volume.s_close(volume) @VolumeOps.GET_MAX_IO_SIZE def _get_max_io_size(ref): @@ -193,6 +192,17 @@ class Volume: return ret + @staticmethod + def s_close(volume): + if not volume.opened: + return + + volume.do_close() + volume.opened = False + + del Volume._instances_[volume.handle] + volume.handle = None + @classmethod def get_io_ops(cls): return IoOps(_set_data=cls._io_set_data, _get_data=cls._io_get_data) @@ -261,8 +271,8 @@ class Volume: def do_open(self): return 0 - def close(self): - self.opened = False + def do_close(self): + pass def get_length(self): raise NotImplementedError diff --git a/tests/functional/pyocf/types/volume_exp_obj.py b/tests/functional/pyocf/types/volume_exp_obj.py index 9d92b5e..6409a9b 100644 --- a/tests/functional/pyocf/types/volume_exp_obj.py +++ b/tests/functional/pyocf/types/volume_exp_obj.py @@ -117,6 +117,9 @@ class ExpObjVolume(Volume): handle = self.get_c_handle() return Volume.s_open(handle, self) + def close(self): + return Volume.s_close(self) + lib = OcfLib.getInstance() lib.ocf_volume_get_max_io_size.argtypes = [c_void_p]