From 940990e37abdd98b27229e12c002753c701178fc Mon Sep 17 00:00:00 2001 From: Katarzyna Treder Date: Wed, 11 Dec 2024 18:12:54 +0100 Subject: [PATCH] Iostat refactor Signed-off-by: Katarzyna Treder --- .../functional/tests/ci/test_ci_read_write.py | 28 +++++++++---------- .../lazy_writes/test_lazy_writes_clean.py | 2 +- .../tests/lazy_writes/test_wb_throttling.py | 8 ++++-- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/test/functional/tests/ci/test_ci_read_write.py b/test/functional/tests/ci/test_ci_read_write.py index 3821c84..91b54bf 100644 --- a/test/functional/tests/ci/test_ci_read_write.py +++ b/test/functional/tests/ci/test_ci_read_write.py @@ -62,7 +62,7 @@ def test_ci_read(cache_mode): dd.run() with TestRun.step("Collect iostat"): - iostat = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) read_cache_1 = iostat[0].total_reads with TestRun.step("Generate cache hits using reads"): @@ -77,7 +77,7 @@ def test_ci_read(cache_mode): dd.run() with TestRun.step("Collect iostat"): - iostat = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) read_cache_2 = iostat[0].total_reads with TestRun.step("Stop cache"): @@ -117,10 +117,10 @@ def test_ci_write_around_write(): casadm.add_core(cache, core_device) with TestRun.step("Collect iostat before I/O"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) write_core_0 = iostat_core[0].total_writes - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) write_cache_0 = iostat_cache[0].total_writes with TestRun.step("Submit writes to exported object"): @@ -136,11 +136,11 @@ def test_ci_write_around_write(): dd.run() with TestRun.step("Collect iostat"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) write_core_1 = iostat_core[0].total_writes read_core_1 = iostat_core[0].total_reads - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) write_cache_1 = iostat_cache[0].total_writes read_cache_1 = iostat_cache[0].total_reads @@ -156,10 +156,10 @@ def test_ci_write_around_write(): dd.run() with TestRun.step("Collect iostat"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) read_core_2 = iostat_core[0].total_reads - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) read_cache_2 = iostat_cache[0].total_reads with TestRun.step("Stop cache"): @@ -221,10 +221,10 @@ def test_ci_write_through_write(): casadm.add_core(cache, core_device) with TestRun.step("Collect iostat before I/O"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) write_core_0 = iostat_core[0].total_writes - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) write_cache_0 = iostat_cache[0].total_writes with TestRun.step("Insert data into the cache using writes"): @@ -241,11 +241,11 @@ def test_ci_write_through_write(): dd.run() with TestRun.step("Collect iostat"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) write_core_1 = iostat_core[0].total_writes read_core_1 = iostat_core[0].total_reads - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) write_cache_1 = iostat_cache[0].total_writes read_cache_1 = iostat_cache[0].total_reads @@ -262,10 +262,10 @@ def test_ci_write_through_write(): dd.run() with TestRun.step("Collect iostat"): - iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device]) + iostat_core = IOstatBasic.get_iostat_list([core_device.parent_device.get_device_id()]) read_core_2 = iostat_core[0].total_reads - iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device]) + iostat_cache = IOstatBasic.get_iostat_list([cache_device.parent_device.get_device_id()]) read_cache_2 = iostat_cache[0].total_reads with TestRun.step("Stop cache"): diff --git a/test/functional/tests/lazy_writes/test_lazy_writes_clean.py b/test/functional/tests/lazy_writes/test_lazy_writes_clean.py index b6405f2..e4b8647 100644 --- a/test/functional/tests/lazy_writes/test_lazy_writes_clean.py +++ b/test/functional/tests/lazy_writes/test_lazy_writes_clean.py @@ -372,4 +372,4 @@ def test_clean_remove_core_without_fs(cache_mode): def check_device_write_stats(device: Device): - return IOstatBasic.get_iostat_list(devices_list=[device])[0].total_writes.value + return IOstatBasic.get_iostat_list(devices_list=[device.get_device_id()])[0].total_writes.value diff --git a/test/functional/tests/lazy_writes/test_wb_throttling.py b/test/functional/tests/lazy_writes/test_wb_throttling.py index 158dae5..39e9b50 100644 --- a/test/functional/tests/lazy_writes/test_wb_throttling.py +++ b/test/functional/tests/lazy_writes/test_wb_throttling.py @@ -89,10 +89,14 @@ def test_wb_throttling(): with TestRun.step("Wait for IO processes to finish and print debug informations"): sleep_interval = timedelta(seconds=5) eta = runtime - while eta.total_seconds() > 0: + while int(eta.total_seconds()) > 0: # Instead of explicit sleeping with `time.sleep()` iostat is used for waiting iostat = IOstatExtended.get_iostat_list( - [core, cache_device, core_device], + [ + core.get_device_id(), + cache_device.get_device_id(), + core_device.get_device_id() + ], since_boot=False, interval=int(sleep_interval.total_seconds()), )