pyocf: more generic erorr device volume

Make ErrorDevice a wraper over any type of volume rather than
inheriting from RamVolume. This way error injection layer can be added
over any type of volume.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2022-04-01 11:36:08 +02:00
parent d8e519855b
commit 3d83e1f004
2 changed files with 29 additions and 7 deletions

View File

@@ -47,7 +47,8 @@ def test_simple_wt_write(pyocf_ctx):
def test_start_corrupted_metadata_lba(pyocf_ctx):
cache_device = ErrorDevice(S.from_MiB(50), error_sectors=set([0]))
ramdisk = RamVolume(S.from_MiB(50))
cache_device = ErrorDevice(ramdisk, error_sectors=set([0]))
with pytest.raises(OcfError, match="OCF_ERR_WRITE_CACHE"):
cache = Cache.start_on_device(cache_device)