pyocf: Move core/cache md5() logic to volume

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2022-03-23 10:45:01 +01:00
parent 16c85c1560
commit 0e8d02235a
6 changed files with 44 additions and 43 deletions

View File

@@ -42,7 +42,7 @@ def test_simple_wt_write(pyocf_ctx):
assert stats["req"]["wr_full_misses"]["value"] == 1
assert stats["usage"]["occupancy"]["value"] == 1
assert core.exp_obj_md5() == core_device.md5()
assert vol.md5() == core_device.md5()
cache.stop()
@@ -110,6 +110,8 @@ def test_load_cache_with_cores(pyocf_ctx, open_cores):
else:
core = cache.get_core_by_name("test_core")
vol = CoreVolume(core, open=True)
read_data = Data(write_data.size)
io = vol.new_io(cache.get_default_queue(), S.from_sector(3).B,
read_data.size, IoDir.READ, 0, 0)
@@ -121,4 +123,4 @@ def test_load_cache_with_cores(pyocf_ctx, open_cores):
cmpl.wait()
assert read_data.md5() == write_data.md5()
assert core.exp_obj_md5() == core_device.md5()
assert vol.md5() == core_device.md5()

View File

@@ -201,7 +201,7 @@ def test_stop(pyocf_ctx, mode: CacheMode, cls: CacheLineSize, with_flush: bool):
assert int(stats["conf"]["dirty"]) == (cls_no if mode.lazy_write() else 0),\
"Dirty data before MD5"
md5_exported_core = core.exp_obj_md5()
md5_exported_core = front_vol.md5()
if with_flush:
cache.flush()
@@ -554,13 +554,13 @@ def check_stats_read_after_write(core, mode, cls, write_to_empty=False):
def check_md5_sums(core: Core, mode: CacheMode):
if mode.lazy_write():
assert core.device.md5() != core.exp_obj_md5(), \
assert core.device.md5() != core.get_front_volume().md5(), \
"MD5 check: core device vs exported object without flush"
core.cache.flush()
assert core.device.md5() == core.exp_obj_md5(), \
assert core.device.md5() == core.get_front_volume().md5(), \
"MD5 check: core device vs exported object after flush"
else:
assert core.device.md5() == core.exp_obj_md5(), \
assert core.device.md5() == core.get_front_volume().md5(), \
"MD5 check: core device vs exported object"