pyocf: warn about not-closed Volumes

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial
2022-06-13 12:14:48 +02:00
parent 4328fd77b0
commit abc726d7f8
3 changed files with 16 additions and 2 deletions

View File

@@ -185,6 +185,7 @@ class Volume:
volume.handle = ref
Volume._instances_[ref] = volume
volume.opened = True
ret = volume.do_open()
if ret == 0:
@@ -273,7 +274,10 @@ class Volume:
return 0
def do_close(self):
del Volume._instances_[self.handle]
try:
del Volume._instances_[self.handle]
except AttributeError:
pass
def get_length(self):
raise NotImplementedError

View File

@@ -29,7 +29,7 @@ class ReplicatedVolume(Volume):
self.primary.close()
return ret
def close(self):
def do_close(self):
self.primary.close()
self.secondary.close()