Fix tests to use new statistics API
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
parent
60200e9fb8
commit
017ec7196a
@ -27,10 +27,10 @@ def test_core_inactive():
|
||||
cache, core_device = prepare()
|
||||
|
||||
cache_device = cache.cache_device
|
||||
stats = cache.get_cache_statistics()
|
||||
stats = cache.get_statistics()
|
||||
|
||||
assert stats["core devices"] == 3
|
||||
assert stats["inactive core devices"] == 0
|
||||
assert stats.config_stats.core_dev == 3
|
||||
assert stats.config_stats.inactive_core_dev == 0
|
||||
|
||||
TestRun.LOGGER.info("Stopping cache")
|
||||
cache.stop()
|
||||
@ -41,10 +41,10 @@ def test_core_inactive():
|
||||
|
||||
TestRun.LOGGER.info("Loading cache with missing core device")
|
||||
cache = casadm.start_cache(cache_device, load=True)
|
||||
stats = cache.get_cache_statistics()
|
||||
stats = cache.get_statistics()
|
||||
|
||||
assert stats["core devices"] == 3
|
||||
assert stats["inactive core devices"] == 1
|
||||
assert stats.config_stats.core_dev == 3
|
||||
assert stats.config_stats.inactive_core_dev == 1
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@ -94,31 +94,34 @@ def test_core_inactive_stats():
|
||||
cores_dirty = 0
|
||||
cores = cache.get_core_devices()
|
||||
for core in cores:
|
||||
core_stats = core.get_core_statistics()
|
||||
cores_occupancy += core_stats["occupancy"].value
|
||||
cores_clean += core_stats["clean"].value
|
||||
cores_dirty += core_stats["dirty"].value
|
||||
core_stats = core.get_statistics()
|
||||
cores_occupancy += core_stats.usage_stats.occupancy.value
|
||||
cores_clean += core_stats.usage_stats.clean.value
|
||||
cores_dirty += core_stats.usage_stats.dirty.value
|
||||
|
||||
cache_stats = cache.get_cache_statistics()
|
||||
cache_stats = cache.get_statistics()
|
||||
# Add inactive core stats
|
||||
cores_occupancy += cache_stats["inactive occupancy"].value
|
||||
cores_clean += cache_stats["inactive clean"].value
|
||||
cores_dirty += cache_stats["inactive dirty"].value
|
||||
cores_occupancy += cache_stats.inactive_usage_stats.inactive_occupancy.value
|
||||
cores_clean += cache_stats.inactive_usage_stats.inactive_clean.value
|
||||
cores_dirty += cache_stats.inactive_usage_stats.inactive_dirty.value
|
||||
|
||||
assert cache_stats["occupancy"].value == cores_occupancy
|
||||
assert cache_stats["dirty"].value == cores_dirty
|
||||
assert cache_stats["clean"].value == cores_clean
|
||||
assert cache_stats.usage_stats.occupancy.value == cores_occupancy
|
||||
assert cache_stats.usage_stats.dirty.value == cores_dirty
|
||||
assert cache_stats.usage_stats.clean.value == cores_clean
|
||||
|
||||
cache_stats_percentage = cache.get_cache_statistics(percentage_val=True)
|
||||
cache_stats_percentage = cache.get_statistics(percentage_val=True)
|
||||
# Calculate expected percentage value of inactive core stats
|
||||
inactive_occupancy_perc = (
|
||||
cache_stats["inactive occupancy"].value / cache_stats["cache size"].value
|
||||
cache_stats.inactive_usage_stats.inactive_occupancy.value
|
||||
/ cache_stats.config_stats.cache_size.value
|
||||
)
|
||||
inactive_clean_perc = (
|
||||
cache_stats["inactive clean"].value / cache_stats["occupancy"].value
|
||||
cache_stats.inactive_usage_stats.inactive_clean.value
|
||||
/ cache_stats.usage_stats.occupancy.value
|
||||
)
|
||||
inactive_dirty_perc = (
|
||||
cache_stats["inactive dirty"].value / cache_stats["occupancy"].value
|
||||
cache_stats.inactive_usage_stats.inactive_dirty.value
|
||||
/ cache_stats.usage_stats.occupancy.value
|
||||
)
|
||||
|
||||
inactive_occupancy_perc = round(100 * inactive_occupancy_perc, 1)
|
||||
@ -126,14 +129,23 @@ def test_core_inactive_stats():
|
||||
inactive_dirty_perc = round(100 * inactive_dirty_perc, 1)
|
||||
|
||||
TestRun.LOGGER.info(str(cache_stats_percentage))
|
||||
assert inactive_occupancy_perc == cache_stats_percentage["inactive occupancy"]
|
||||
assert inactive_clean_perc == cache_stats_percentage["inactive clean"]
|
||||
assert inactive_dirty_perc == cache_stats_percentage["inactive dirty"]
|
||||
assert (
|
||||
inactive_occupancy_perc
|
||||
== cache_stats_percentage.inactive_usage_stats.inactive_occupancy
|
||||
)
|
||||
assert (
|
||||
inactive_clean_perc
|
||||
== cache_stats_percentage.inactive_usage_stats.inactive_clean
|
||||
)
|
||||
assert (
|
||||
inactive_dirty_perc
|
||||
== cache_stats_percentage.inactive_usage_stats.inactive_dirty
|
||||
)
|
||||
|
||||
|
||||
def prepare():
|
||||
cache_device = TestRun.disks['cache']
|
||||
core_device = TestRun.disks['core']
|
||||
cache_device = TestRun.disks["cache"]
|
||||
core_device = TestRun.disks["core"]
|
||||
|
||||
cache_device.create_partitions([Size(500, Unit.MebiByte)])
|
||||
core_device.create_partitions(
|
||||
|
@ -72,7 +72,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
)
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
TestRun.LOGGER.info("Reading the file in the nested directory")
|
||||
dd = (
|
||||
Dd()
|
||||
@ -82,7 +82,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
)
|
||||
dd.run()
|
||||
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + test_file_1.size, \
|
||||
"Wrong occupancy after reading file!\n" \
|
||||
f"Expected: {base_occupancy + test_file_1.size}, actual: {new_occupancy}"
|
||||
@ -103,7 +103,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
test_file_2.refresh_item()
|
||||
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + test_file_2.size, \
|
||||
"Wrong occupancy after creating file!\n" \
|
||||
f"Expected: {base_occupancy + test_file_2.size}, actual: {new_occupancy}"
|
||||
@ -122,7 +122,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
"""
|
||||
def create_files_with_classification_delay_check(directory: Directory, ioclass_id: int):
|
||||
start_time = datetime.now()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
dd_blocks = 10
|
||||
dd_size = Size(dd_blocks, Unit.Blocks4096)
|
||||
file_counter = 0
|
||||
@ -135,7 +135,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
time_from_start = datetime.now() - start_time
|
||||
(Dd().input("/dev/zero").output(file_path).oflag("sync")
|
||||
.block_size(Size(1, Unit.Blocks4096)).count(dd_blocks).run())
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after - occupancy_before < dd_size:
|
||||
unclassified_files.append(file_path)
|
||||
|
||||
@ -151,9 +151,9 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
def read_files_with_reclassification_check(
|
||||
target_ioclass_id: int, source_ioclass_id: int, directory: Directory, with_delay: bool):
|
||||
start_time = datetime.now()
|
||||
target_occupancy_after = cache.get_cache_statistics(
|
||||
target_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=target_ioclass_id)["occupancy"]
|
||||
source_occupancy_after = cache.get_cache_statistics(
|
||||
source_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=source_ioclass_id)["occupancy"]
|
||||
unclassified_files = []
|
||||
|
||||
@ -163,9 +163,9 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
time_from_start = datetime.now() - start_time
|
||||
(Dd().input(file.full_path).output("/dev/null")
|
||||
.block_size(Size(1, Unit.Blocks4096)).run())
|
||||
target_occupancy_after = cache.get_cache_statistics(
|
||||
target_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=target_ioclass_id)["occupancy"]
|
||||
source_occupancy_after = cache.get_cache_statistics(
|
||||
source_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=source_ioclass_id)["occupancy"]
|
||||
if target_occupancy_after < target_occupancy_before:
|
||||
pytest.xfail("Target IO class occupancy lowered!")
|
||||
@ -323,7 +323,7 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Creating test file")
|
||||
classified_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
file_path = f"{test_dir_path}/test_file"
|
||||
(Dd().input("/dev/urandom").output(file_path).oflag("sync")
|
||||
.block_size(Size(1, Unit.MebiByte)).count(dd_blocks).run())
|
||||
@ -332,21 +332,21 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
test_file = File(file_path).refresh_item()
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before + test_file.size, classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Moving test file out of classified directory")
|
||||
classified_before = classified_after
|
||||
non_classified_before = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_before = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
test_file.move(destination=mountpoint)
|
||||
sync()
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Reading test file")
|
||||
@ -356,10 +356,10 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
.block_size(Size(1, Unit.MebiByte)).run())
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before - test_file.size, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before + test_file.size, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info(f"Moving test file to {nested_dir_path}")
|
||||
@ -370,10 +370,10 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Reading test file")
|
||||
@ -383,8 +383,8 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
.block_size(Size(1, Unit.MebiByte)).run())
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before + test_file.size, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before - test_file.size, non_classified_after)
|
||||
|
@ -56,7 +56,7 @@ def test_ioclass_file_extension():
|
||||
for i in range(iterations):
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == (i + 1) * dd_count
|
||||
|
||||
cache.flush_cache()
|
||||
@ -73,7 +73,7 @@ def test_ioclass_file_extension():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ def test_ioclass_file_extension_preexisting_filesystem():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096)
|
||||
== (extensions.index(ext) + 1) * dd_count
|
||||
@ -191,7 +191,7 @@ def test_ioclass_file_offset():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 1
|
||||
), f"Offset not cached: {file_offset}"
|
||||
@ -212,7 +212,7 @@ def test_ioclass_file_offset():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
), f"Inappropriately cached offset: {file_offset}"
|
||||
@ -271,10 +271,10 @@ def test_ioclass_file_size(filesystem):
|
||||
TestRun.LOGGER.info("Creating files belonging to different IO classes "
|
||||
"(classification by writes).")
|
||||
for size, ioclass_id in size_to_class.items():
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
file_path = f"{mountpoint}/test_file_{size.get_value()}"
|
||||
Dd().input("/dev/zero").output(file_path).oflag("sync").block_size(size).count(1).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after != occupancy_before + size:
|
||||
pytest.xfail("File not cached properly!\n"
|
||||
f"Expected {occupancy_before + size}\n"
|
||||
@ -288,9 +288,9 @@ def test_ioclass_file_size(filesystem):
|
||||
"(classification by reads).")
|
||||
for file in test_files:
|
||||
ioclass_id = size_to_class[file.size]
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
Dd().input(file.full_path).output("/dev/null").block_size(file.size).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after != occupancy_before + file.size:
|
||||
pytest.xfail("File not reclassified properly!\n"
|
||||
f"Expected {occupancy_before + file.size}\n"
|
||||
@ -312,10 +312,10 @@ def test_ioclass_file_size(filesystem):
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
for file in test_files:
|
||||
Dd().input(file.full_path).output("/dev/null").block_size(file.size).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
if occupancy_after != occupancy_before + file.size:
|
||||
pytest.xfail("File not reclassified properly!\n"
|
||||
f"Expected {occupancy_before + file.size}\n"
|
||||
|
@ -50,7 +50,7 @@ def test_ioclass_process_name():
|
||||
dd.run()
|
||||
sync()
|
||||
time.sleep(0.1)
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == (i + 1) * dd_count
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ def test_ioclass_pid():
|
||||
f"stdout: {output.stdout} \n stderr :{output.stderr}"
|
||||
)
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == dd_count
|
||||
|
||||
ioclass_config.remove_ioclass(ioclass_id)
|
||||
|
@ -62,7 +62,7 @@ def test_ioclass_lba():
|
||||
sync()
|
||||
dirty_count += 1
|
||||
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == dirty_count
|
||||
), f"LBA {lba} not cached"
|
||||
@ -86,7 +86,7 @@ def test_ioclass_lba():
|
||||
dd.run()
|
||||
sync()
|
||||
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
), f"Inappropriately cached lba: {rand_lba}"
|
||||
@ -128,7 +128,7 @@ def test_ioclass_request_size():
|
||||
.oflag("direct")
|
||||
)
|
||||
dd.run()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096)
|
||||
== req_size.value / Unit.Blocks4096.value
|
||||
@ -156,7 +156,7 @@ def test_ioclass_request_size():
|
||||
.oflag("direct")
|
||||
)
|
||||
dd.run()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
||||
@ -206,12 +206,12 @@ def test_ioclass_direct(filesystem):
|
||||
else:
|
||||
TestRun.LOGGER.info("Testing on raw exported object")
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
|
||||
TestRun.LOGGER.info(f"Buffered writes to {'file' if filesystem else 'device'}")
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Buffered writes were cached!\n" \
|
||||
f"Expected: {base_occupancy}, actual: {new_occupancy}"
|
||||
@ -220,7 +220,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.direct()
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + io_size, \
|
||||
"Wrong number of direct writes was cached!\n" \
|
||||
f"Expected: {base_occupancy + io_size}, actual: {new_occupancy}"
|
||||
@ -230,7 +230,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.read_write(ReadWrite.read)
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Buffered reads did not cause reclassification!" \
|
||||
f"Expected occupancy: {base_occupancy}, actual: {new_occupancy}"
|
||||
@ -239,7 +239,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.direct()
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + io_size, \
|
||||
"Wrong number of direct reads was cached!\n" \
|
||||
f"Expected: {base_occupancy + io_size}, actual: {new_occupancy}"
|
||||
@ -274,7 +274,7 @@ def test_ioclass_metadata(filesystem):
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
requests_to_metadata_before = cache.get_cache_statistics(
|
||||
requests_to_metadata_before = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
TestRun.LOGGER.info("Creating 20 test files")
|
||||
files = []
|
||||
@ -292,7 +292,7 @@ def test_ioclass_metadata(filesystem):
|
||||
files.append(File(file_path))
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while creating files!")
|
||||
@ -304,7 +304,7 @@ def test_ioclass_metadata(filesystem):
|
||||
sync()
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while renaming files!")
|
||||
@ -320,7 +320,7 @@ def test_ioclass_metadata(filesystem):
|
||||
sync()
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while moving files!")
|
||||
@ -329,7 +329,7 @@ def test_ioclass_metadata(filesystem):
|
||||
fs_utils.remove(path=test_dir_path, force=True, recursive=True)
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while deleting directory with files!")
|
||||
@ -409,7 +409,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# IO fulfilling IO class 1 condition (and not IO class 2)
|
||||
# Should be classified as IO class 4
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=4)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=4)["occupancy"]
|
||||
non_ioclass_file_size = Size(random.randrange(1, 25), Unit.MebiByte)
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
@ -418,7 +418,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{base_dir_path}/test_file_1")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=4)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=4)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + non_ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@ -426,7 +426,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# IO fulfilling IO class 2 condition (and not IO class 1)
|
||||
# Should be classified as IO class 5
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(ioclass_file_size)
|
||||
@ -434,7 +434,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{mountpoint}/test_file_2")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@ -450,7 +450,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{base_dir_path}/test_file_3")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@ -458,7 +458,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# Same IO but direct
|
||||
# Should be classified as IO class 6
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=6)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=6)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(ioclass_file_size)
|
||||
@ -467,7 +467,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.direct()
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=6)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=6)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@ -507,7 +507,7 @@ def test_ioclass_conditions_or(filesystem):
|
||||
# Perform IO fulfilling each condition and check if occupancy raises
|
||||
for i in range(1, 6):
|
||||
file_size = Size(random.randint(25, 50), Unit.MebiByte)
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(file_size)
|
||||
@ -515,7 +515,7 @@ def test_ioclass_conditions_or(filesystem):
|
||||
.target(f"{mountpoint}/dir{i}/test_file")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + file_size, \
|
||||
"Occupancy has not increased correctly!\n" \
|
||||
@ -554,7 +554,7 @@ def test_ioclass_conditions_and(filesystem):
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
# Perform IO
|
||||
for size in [file_size, file_size + Size(1, Unit.MebiByte), file_size - Size(1, Unit.MebiByte)]:
|
||||
(Fio().create_command()
|
||||
@ -564,7 +564,7 @@ def test_ioclass_conditions_and(filesystem):
|
||||
.target(f"{mountpoint}/test_file")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Unexpected occupancy increase!\n" \
|
||||
|
@ -112,8 +112,8 @@ def test_block_stats_write(cache_mode, zero_stats):
|
||||
for i in range(iterations):
|
||||
dd.seek(dd_seek)
|
||||
dd.run()
|
||||
cache_stats = cache.get_cache_statistics(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_core_statistics(stat_filter=[StatsFilter.blk])
|
||||
cache_stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
|
||||
# Check cache stats
|
||||
assumed_value = (dd_size.get_value(Unit.Blocks4096) * dd_count) * (i + 1)
|
||||
@ -237,8 +237,8 @@ def test_block_stats_read(cache_mode, zero_stats):
|
||||
for i in range(iterations):
|
||||
dd.skip(dd_skip)
|
||||
dd.run()
|
||||
cache_stats = cache.get_cache_statistics(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_core_statistics(stat_filter=[StatsFilter.blk])
|
||||
cache_stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
|
||||
# Check cache stats
|
||||
assumed_value = (dd_size.get_value(Unit.Blocks4096) * dd_count) * (i + 1)
|
||||
@ -283,7 +283,7 @@ def test_block_stats_read(cache_mode, zero_stats):
|
||||
def flush(cache):
|
||||
cache.flush_cache()
|
||||
cache.reset_counters()
|
||||
stats = cache.get_cache_statistics(stat_filter=[StatsFilter.blk])
|
||||
stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
for key, value in stats.items():
|
||||
assert value.get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
@ -105,11 +105,11 @@ def test_ioclass_stats_sum():
|
||||
core.unmount()
|
||||
sync()
|
||||
|
||||
cache_stats = cache.get_cache_statistics(
|
||||
cache_stats = cache.get_statistics_deprecated(
|
||||
stat_filter=[StatsFilter.usage, StatsFilter.req, StatsFilter.blk]
|
||||
)
|
||||
for ioclass_id in ioclass_id_list:
|
||||
ioclass_stats = cache.get_cache_statistics(
|
||||
ioclass_stats = cache.get_statistics_deprecated(
|
||||
stat_filter=[StatsFilter.usage, StatsFilter.req, StatsFilter.blk],
|
||||
io_class_id=ioclass_id,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user