Check for FLUSH and FUA signals sent to multilevel cache in lazy-write modes
Add test for checking for logs of requests insyslog from OpenCAS when SCSI_DEBUG module is base-level core device in multilevel cache. Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
parent
c01956d0e1
commit
93ace7d520
@ -218,6 +218,117 @@ def test_flush_signal_cache(cache_mode):
|
||||
cache.stop()
|
||||
|
||||
|
||||
@pytest.mark.require_plugin("scsi_debug_fua_signals", dev_size_mb="2048", opts="1")
|
||||
@pytest.mark.parametrize("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
def test_flush_signal_multilevel_cache(cache_mode):
|
||||
"""
|
||||
title: Test for FLUSH and FUA signals sent to multilevel cache in modes with lazy writes.
|
||||
description: |
|
||||
Test if OpenCAS transmits FLUSH and FUA signals with multilevel cache in lazy-write modes.
|
||||
pass_criteria:
|
||||
- FLUSH requests should be passed by multilevel cache to core device.
|
||||
- FUA requests should be passed by multilevel cache to core device.
|
||||
"""
|
||||
with TestRun.step("Set mark in syslog to not read entries existing before the test."):
|
||||
Logs._read_syslog(Logs.last_read_line)
|
||||
|
||||
with TestRun.step("Prepare devices for multilevel cache."):
|
||||
cache_dev = TestRun.disks['cache']
|
||||
cache_dev.create_partitions([Size(1, Unit.GibiByte)] * 2)
|
||||
cache_part1 = cache_dev.partitions[0]
|
||||
cache_part2 = cache_dev.partitions[1]
|
||||
core_dev = TestRun.scsi_debug_devices[0]
|
||||
|
||||
with TestRun.step("Start the first cache and add the SCSI device as a core."):
|
||||
cache1 = casadm.start_cache(cache_part1, cache_mode)
|
||||
core1 = cache1.add_core(core_dev)
|
||||
|
||||
with TestRun.step("Start the second cache and add the 1st exported object as core."):
|
||||
cache2 = casadm.start_cache(cache_part2, cache_mode)
|
||||
core2 = cache2.add_core(core1)
|
||||
|
||||
with TestRun.step("Create xfs filesystem on the 2nd exported object and mount it."):
|
||||
core2.create_filesystem(Filesystem.xfs)
|
||||
if core2.is_mounted():
|
||||
core2.unmount()
|
||||
core2.mount(mount_point)
|
||||
|
||||
with TestRun.step("Turn off cleaning policy on both caches."):
|
||||
cache1.set_cleaning_policy(CleaningPolicy.nop)
|
||||
cache2.set_cleaning_policy(CleaningPolicy.nop)
|
||||
|
||||
with TestRun.step("Create temporary file on the 2nd exported object."):
|
||||
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step("Flush both caches."):
|
||||
cache2.flush_cache()
|
||||
cache1.flush_cache()
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step(f"Check {syslog_path} for flush and FUA requests and delete temporary file."):
|
||||
Logs.check_syslog_for_signals()
|
||||
tmp_file.remove(True)
|
||||
|
||||
with TestRun.step("Create temporary file on the 2nd exported object."):
|
||||
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step("Flush both cores."):
|
||||
core2.flush_core()
|
||||
core1.flush_core()
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step(f"Check {syslog_path} for flush request and delete temporary file."):
|
||||
Logs.check_syslog_for_signals()
|
||||
tmp_file.remove(True)
|
||||
|
||||
with TestRun.step("Turn on alru cleaning policy and set policy params on both caches."):
|
||||
cache1.set_cleaning_policy(CleaningPolicy.alru)
|
||||
cache1.set_params_alru(FlushParametersAlru(
|
||||
Time(milliseconds=5000), 10000, Time(seconds=10), Time(seconds=10))
|
||||
)
|
||||
cache2.set_cleaning_policy(CleaningPolicy.alru)
|
||||
cache2.set_params_alru(FlushParametersAlru(
|
||||
Time(milliseconds=5000), 10000, Time(seconds=10), Time(seconds=10))
|
||||
)
|
||||
|
||||
with TestRun.step("Create big temporary file on the 2nd exported object."):
|
||||
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(3, Unit.GibiByte))
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step("Wait for automatic flush from alru cleaning policy and check log."):
|
||||
wait_time = (
|
||||
int(cache2.get_flush_parameters_alru().staleness_time.total_seconds())
|
||||
+ int(cache2.get_flush_parameters_alru().activity_threshold.total_seconds())
|
||||
+ int(cache2.get_flush_parameters_alru().wake_up_time.total_seconds())
|
||||
+ 5
|
||||
)
|
||||
sleep(wait_time)
|
||||
|
||||
with TestRun.step(f"Check {syslog_path} for flush and FUA requests and delete temporary file."):
|
||||
Logs.check_syslog_for_signals()
|
||||
tmp_file.remove(True)
|
||||
|
||||
with TestRun.step("Create temporary file on the 2nd exported object."):
|
||||
create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step("Unmount the 2nd exported object and remove cores from caches."):
|
||||
core2.unmount()
|
||||
core2.remove_core()
|
||||
core1.remove_core()
|
||||
os_utils.sync()
|
||||
|
||||
with TestRun.step(f"Check {syslog_path} for flush request."):
|
||||
Logs.check_syslog_for_signals()
|
||||
|
||||
with TestRun.step("Stop both caches."):
|
||||
cache2.stop()
|
||||
cache1.stop()
|
||||
|
||||
|
||||
class Logs:
|
||||
last_read_line = 1
|
||||
FLUSH = re.compile(r"scsi_debug:[\s\S]*cmd 35")
|
||||
|
Loading…
Reference in New Issue
Block a user