IO classification tests fixes
Signed-off-by: Katarzyna Lapinska <katarzyna.lapinska@intel.com>
This commit is contained in:
parent
f967596b47
commit
b0c7bea427
@ -27,10 +27,11 @@ mountpoint = "/tmp/cas1-1"
|
||||
|
||||
|
||||
def prepare(
|
||||
cache_size=Size(500, Unit.MebiByte),
|
||||
core_size=Size(10, Unit.GibiByte),
|
||||
cache_size=Size(10, Unit.GibiByte),
|
||||
core_size=Size(40, Unit.GibiByte),
|
||||
cache_mode=CacheMode.WB,
|
||||
cache_line_size=CacheLineSize.LINE_4KiB,
|
||||
default_allocation="0.00"
|
||||
):
|
||||
ioclass_config.remove_ioclass_config()
|
||||
cache_device = TestRun.disks["cache"]
|
||||
@ -62,7 +63,7 @@ def prepare(
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_config.DEFAULT_IO_CLASS_ID,
|
||||
eviction_priority=ioclass_config.DEFAULT_IO_CLASS_PRIORITY,
|
||||
allocation="0.00",
|
||||
allocation=default_allocation,
|
||||
rule=ioclass_config.DEFAULT_IO_CLASS_RULE,
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -97,14 +98,18 @@ def run_io_dir(path, size_4k):
|
||||
.block_size(Size(1, Unit.Blocks4096))
|
||||
)
|
||||
TestRun.LOGGER.info(f"{dd}")
|
||||
dd.run()
|
||||
output = dd.run()
|
||||
if output.exit_code != 0:
|
||||
TestRun.fail(f"Failed to execute dd.\n {output.stdout}\n{output.stderr}")
|
||||
sync()
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
|
||||
def run_io_dir_read(path):
|
||||
dd = Dd().output("/dev/null").input(f"{path}")
|
||||
dd.run()
|
||||
output = dd.run()
|
||||
if output.exit_code != 0:
|
||||
TestRun.fail(f"Failed to execute dd.\n {output.stdout}\n{output.stderr}")
|
||||
sync()
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
|
@ -141,7 +141,7 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
dd_blocks = random.randint(5, 50)
|
||||
|
||||
with TestRun.step("Prepare cache and core."):
|
||||
cache, core = prepare()
|
||||
cache, core = prepare(default_allocation="1.00")
|
||||
Udev.disable()
|
||||
|
||||
with TestRun.step("Create and load IO class config file."):
|
||||
@ -263,7 +263,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
non_classified_dir_path = f"{mountpoint}/non_classified"
|
||||
|
||||
with TestRun.step("Prepare cache and core."):
|
||||
cache, core = prepare()
|
||||
cache, core = prepare(default_allocation="1.00")
|
||||
Udev.disable()
|
||||
|
||||
with TestRun.step("Create and load IO class config file."):
|
||||
@ -437,8 +437,7 @@ def read_files_with_reclassification_check(cache, target_ioclass_id: int, source
|
||||
|
||||
def check_occupancy(expected: Size, actual: Size):
|
||||
if expected != actual:
|
||||
TestRun.LOGGER.error("Occupancy check failed!\n"
|
||||
f"Expected: {expected}, actual: {actual}")
|
||||
TestRun.LOGGER.error(f"Occupancy check failed!\nExpected: {expected}, actual: {actual}")
|
||||
|
||||
|
||||
def ioclass_is_enabled(cache, ioclass_id: int):
|
||||
|
@ -369,7 +369,7 @@ def test_ioclass_file_size(filesystem):
|
||||
}
|
||||
|
||||
with TestRun.step("Prepare cache and core."):
|
||||
cache, core = prepare()
|
||||
cache, core = prepare(default_allocation="1.00")
|
||||
|
||||
with TestRun.step("Prepare and load IO class config."):
|
||||
load_file_size_io_classes(cache, base_size)
|
||||
@ -405,10 +405,17 @@ def test_ioclass_file_size(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=0,
|
||||
eviction_priority=22,
|
||||
allocation="0.00",
|
||||
allocation="1.00",
|
||||
rule="unclassified",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=6,
|
||||
eviction_priority=1,
|
||||
allocation="0.00",
|
||||
rule=f"metadata",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
occupancy_before = cache.get_io_class_statistics(io_class_id=0).usage_stats.occupancy
|
||||
for file in test_files:
|
||||
@ -430,7 +437,7 @@ def test_ioclass_file_size(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=0,
|
||||
eviction_priority=22,
|
||||
allocation="0.00",
|
||||
allocation="1.00",
|
||||
rule="unclassified",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -461,6 +468,13 @@ def test_ioclass_file_size(filesystem):
|
||||
def load_file_size_io_classes(cache, base_size):
|
||||
# IO class order intentional, do not change
|
||||
base_size_bytes = int(base_size.get_value(Unit.Byte))
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=6,
|
||||
eviction_priority=1,
|
||||
allocation="0.00",
|
||||
rule=f"metadata",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
eviction_priority=1,
|
||||
@ -496,4 +510,5 @@ def load_file_size_io_classes(cache, base_size):
|
||||
rule=f"file_size:ge:{2 * base_size_bytes}",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
|
@ -50,7 +50,7 @@ def test_ioclass_lba():
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_id,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"lba:ge:{min_cached_lba}&lba:le:{max_cached_lba}&done",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -124,7 +124,7 @@ def test_ioclass_request_size():
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_id,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"request_size:ge:8192&request_size:le:16384&done",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -201,7 +201,7 @@ def test_ioclass_direct(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_id,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule="direct",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -299,7 +299,7 @@ def test_ioclass_metadata(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_id,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule="metadata&done",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -397,7 +397,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"directory:{base_dir_path}",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -405,7 +405,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=2,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"file_size:eq:{ioclass_file_size_bytes}",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -413,7 +413,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=3,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule="direct",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -421,7 +421,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=4,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule="io_class:1|io_class:2",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -429,7 +429,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=5,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"io_class:4&file_size:eq:{ioclass_file_size_bytes}",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -437,7 +437,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=6,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule="io_class:3",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
@ -545,7 +545,7 @@ def test_ioclass_conditions_or(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"directory:{mountpoint}/dir1|directory:{mountpoint}/dir2|directory:"
|
||||
f"{mountpoint}/dir3|directory:{mountpoint}/dir4|directory:{mountpoint}/dir5",
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
@ -605,7 +605,7 @@ def test_ioclass_conditions_and(filesystem):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
eviction_priority=1,
|
||||
allocation=True,
|
||||
allocation="1.00",
|
||||
rule=f"file_size:gt:{file_size_bytes}&file_size:lt:{file_size_bytes}&"
|
||||
f"file_size:ge:{file_size_bytes}&file_size:le:{file_size_bytes}&"
|
||||
f"file_size:eq:{file_size_bytes}",
|
||||
@ -651,7 +651,7 @@ def test_ioclass_effective_ioclass(filesystem):
|
||||
- In every iteration second IO is classified to the IO class with '&done' annotation
|
||||
"""
|
||||
with TestRun.LOGGER.step(f"Test prepare"):
|
||||
cache, core = prepare()
|
||||
cache, core = prepare(default_allocation="1.00")
|
||||
Udev.disable()
|
||||
file_size = Size(10, Unit.Blocks4096)
|
||||
file_size_bytes = int(file_size.get_value(Unit.Byte))
|
||||
@ -719,7 +719,7 @@ def load_io_classes_in_permutation_order(rules, permutation, cache):
|
||||
)
|
||||
# To make test more precise all workload except of tested ioclass should be
|
||||
# put in pass-through mode
|
||||
ioclass_list = [IoClass.default(allocation=False)]
|
||||
ioclass_list = [IoClass.default(allocation="0.0")]
|
||||
for n in range(len(rules)):
|
||||
ioclass_list.append(IoClass(class_id=permutation[n], rule=rules[n]))
|
||||
IoClass.save_list_to_config_file(ioclass_list,
|
||||
|
Loading…
Reference in New Issue
Block a user