def setup_workload(target: str, runtime: timedelta, io_depth=128, verify=True, block_size=int(Size(4, Unit.KibiByte)), num_jobs=1, method=ReadWrite.randrw, io_engine=IoEngine.libaio): fio_run = Fio().create_command() fio_run.io_engine(io_engine) fio_run.direct() fio_run.time_based() fio_run.run_time(runtime) fio_run.io_depth(io_depth) if verify: fio_run.do_verify() fio_run.verify(VerifyMethod.meta) fio_run.verify_dump() fio_run.read_write(method) fio_run.target(target) fio_run.block_size(block_size) for i in range(num_jobs): fio_run.add_job() return fio_run
def fill_cache(target): fio_run_fill = Fio().create_command() fio_run_fill.io_engine(IoEngine.libaio) fio_run_fill.direct() fio_run_fill.read_write(ReadWrite.write) fio_run_fill.io_depth(16) fio_run_fill.block_size(Size(1, Unit.MebiByte)) fio_run_fill.target(target) fio_run_fill.run()
def fio_workload(target: str, runtime: timedelta): fio_run = Fio().create_command() fio_run.io_engine(IoEngine.libaio) fio_run.direct() fio_run.time_based() fio_run.run_time(runtime) fio_run.io_depth(64) fio_run.read_write(ReadWrite.readwrite) fio_run.target(target) fio_run.block_size(int(Size(4, Unit.KibiByte))) return fio_run
def run_workload(target): fio_run = Fio().create_command() fio_run.io_engine(IoEngine.libaio) fio_run.direct() fio_run.time_based() fio_run.do_verify() fio_run.verify(VerifyMethod.meta) fio_run.verify_dump() fio_run.run_time(runtime) fio_run.read_write(ReadWrite.randrw) fio_run.io_depth(128) fio_run.target(target) for block_size in range(start_size, stop_size + 1, step): fio_job = fio_run.add_job() fio_job.stonewall() fio_job.block_size(block_size) fio_run.run()
def test_zero_metadata_dirty_data(): """ title: Test for '--zero-metadata' and dirty data scenario. description: | Test for '--zero-metadata' with and without 'force' option if there are dirty data on cache. pass_criteria: - Zeroing metadata without force failed on cache with dirty data. - Zeroing metadata with force ran successfully on cache with dirty data. - Cache started successfully after zeroing metadata on cache with dirty data. """ with TestRun.step("Prepare cache and core devices."): cache_dev, core_disk, cache_disk = prepare_devices() with TestRun.step("Start cache."): cache = casadm.start_cache(cache_dev, CacheMode.WB, force=True) core = cache.add_core(core_disk) cache.set_cleaning_policy(CleaningPolicy.nop) with TestRun.step("Run workload on CAS"): fio_run_fill = Fio().create_command() fio_run_fill.io_engine(IoEngine.libaio) fio_run_fill.direct() fio_run_fill.read_write(ReadWrite.randwrite) fio_run_fill.io_depth(16) fio_run_fill.block_size(Size(1, Unit.MebiByte)) fio_run_fill.target(core.path) fio_run_fill.run_time(timedelta(seconds=5)) fio_run_fill.time_based() fio_run_fill.run() with TestRun.step("Stop cache without flushing dirty data."): cache.stop(no_data_flush=True) with TestRun.step("Start cache (expect to fail)."): try: cache = casadm.start_cache(cache_dev, CacheMode.WB) except CmdException: TestRun.LOGGER.info("Start cache failed as expected.") with TestRun.step("Zeroing metadata on CAS device without force"): try: casadm.zero_metadata(cache_dev) TestRun.LOGGER.error("Zeroing metadata without force should fail!") except CmdException as e: cli_messages.check_stderr_msg(e.output, cli_messages.cache_dirty_data) with TestRun.step("Zeroing metadata on cache device with force"): try: casadm.zero_metadata(cache_dev, force=True) TestRun.LOGGER.info("Zeroing metadata with force successful!") except CmdException as e: TestRun.LOGGER.error( f"Zeroing metadata with force should work for cache device!" f"Error message: {e.output}") with TestRun.step("Start cache without 'force' option."): try: cache = casadm.start_cache(cache_dev, CacheMode.WB) TestRun.LOGGER.info("Cache started successfully.") except CmdException: TestRun.LOGGER.error("Start cache failed.")