pyocf: test update to handle zeroed metadata in attach
With atomic superblock commit during cache attach, it is possible that power failure interrupts attach operation at a point where neither new or old superblock is present - right after the superblock is cleared. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
366d89a9c4
commit
ae240f5aa8
@ -427,14 +427,23 @@ def test_surprise_shutdown_cache_reinit(pyocf_ctx):
|
|||||||
|
|
||||||
device.disarm()
|
device.disarm()
|
||||||
|
|
||||||
cache = Cache.load_from_device(device)
|
cache = None
|
||||||
|
status = OcfErrorCode.OCF_OK
|
||||||
|
try:
|
||||||
|
cache = Cache.load_from_device(device)
|
||||||
|
except OcfError as ex:
|
||||||
|
status = ex.error_code
|
||||||
|
|
||||||
stats = cache.get_stats()
|
if not cache:
|
||||||
if stats["conf"]["core_count"] == 0:
|
assert status == OcfErrorCode.OCF_ERR_NO_METADATA
|
||||||
cache.add_core(core)
|
else:
|
||||||
assert ocf_read(cache, core, io_offset) == Volume.VOLUME_POISON
|
stats = cache.get_stats()
|
||||||
|
if stats["conf"]["core_count"] == 0:
|
||||||
|
assert stats["usage"]["occupancy"]["value"] == 0
|
||||||
|
cache.add_core(core)
|
||||||
|
assert ocf_read(cache, core, io_offset) == Volume.VOLUME_POISON
|
||||||
|
|
||||||
cache.stop()
|
cache.stop()
|
||||||
|
|
||||||
error_io[IoDir.WRITE] += 1
|
error_io[IoDir.WRITE] += 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user