pyocf: make open/close explicit
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
@@ -191,7 +191,7 @@ def prepare_cache_and_core(core_size: Size, cache_size: Size = Size.from_MiB(50)
|
||||
core = Core.using_device(core_device)
|
||||
|
||||
cache.add_core(core)
|
||||
vol = CoreVolume(core, open=True)
|
||||
vol = CoreVolume(core)
|
||||
queue = cache.get_default_queue()
|
||||
|
||||
return vol, queue
|
||||
@@ -200,6 +200,7 @@ def prepare_cache_and_core(core_size: Size, cache_size: Size = Size.from_MiB(50)
|
||||
def io_operation(
|
||||
vol: Volume, queue: Queue, data: Data, io_direction: int, offset: int = 0, io_class: int = 0,
|
||||
):
|
||||
vol.open()
|
||||
io = vol.new_io(queue, offset, data.size, io_direction, io_class, 0)
|
||||
io.set_data(data)
|
||||
|
||||
@@ -207,4 +208,5 @@ def io_operation(
|
||||
io.callback = completion.callback
|
||||
io.submit()
|
||||
completion.wait()
|
||||
vol.close()
|
||||
return completion
|
||||
|
@@ -82,10 +82,11 @@ def test_secure_erase_simple_io_read_misses(cache_mode):
|
||||
core_device = RamVolume(S.from_MiB(50))
|
||||
core = Core.using_device(core_device)
|
||||
cache.add_core(core)
|
||||
vol = CoreVolume(core, open=True)
|
||||
vol = CoreVolume(core)
|
||||
queue = cache.get_default_queue()
|
||||
|
||||
write_data = DataCopyTracer(S.from_sector(1))
|
||||
vol.open()
|
||||
io = vol.new_io(queue, S.from_sector(1).B, write_data.size, IoDir.WRITE, 0, 0,)
|
||||
io.set_data(write_data)
|
||||
|
||||
@@ -117,6 +118,7 @@ def test_secure_erase_simple_io_read_misses(cache_mode):
|
||||
io.submit()
|
||||
cmpl.wait()
|
||||
|
||||
vol.close()
|
||||
stats = cache.get_stats()
|
||||
|
||||
ctx.exit()
|
||||
@@ -156,10 +158,12 @@ def test_secure_erase_simple_io_cleaning():
|
||||
core_device = RamVolume(S.from_MiB(100))
|
||||
core = Core.using_device(core_device)
|
||||
cache.add_core(core)
|
||||
vol = CoreVolume(core, open=True)
|
||||
vol = CoreVolume(core)
|
||||
queue = cache.get_default_queue()
|
||||
|
||||
read_data = Data(S.from_sector(1).B)
|
||||
|
||||
vol.open()
|
||||
io = vol.new_io(queue, S.from_sector(1).B, read_data.size, IoDir.WRITE, 0, 0)
|
||||
io.set_data(read_data)
|
||||
|
||||
@@ -177,6 +181,7 @@ def test_secure_erase_simple_io_cleaning():
|
||||
io.submit()
|
||||
cmpl.wait()
|
||||
|
||||
vol.close()
|
||||
stats = cache.get_stats()
|
||||
|
||||
ctx.exit()
|
||||
|
Reference in New Issue
Block a user