def power_cycle_dut(wait_for_flush_begin=False, core_device=None): if wait_for_flush_begin: if not core_device: raise Exception("Core device is None.") TestRun.LOGGER.info("Waiting for flushing to begin...") core_writes_before = core_device.get_io_stats().sectors_written os_utils.wait(lambda: core_writes_before < core_device.get_io_stats().sectors_written, timedelta(minutes=3), timedelta(milliseconds=100)) power_control = TestRun.plugin_manager.get_plugin('power_control') power_control.power_cycle()
def wait_for_status_change(self, expected_status: CoreStatus): timeout = timedelta(minutes=1) if not wait(lambda: self.get_status() == expected_status, timeout, timedelta(seconds=1)): TestRun.fail( f"Core status did not change after {timeout.total_seconds()}s." )
def wait_for_plug_status(self, should_be_visible): if not wait(lambda: should_be_visible == self.is_detected(), timedelta(minutes=1), timedelta(seconds=1)): raise Exception( f"Timeout occurred while trying to " f"{'plug' if should_be_visible else 'unplug'} disk.")
def test_wb_throttling(): """ title: Test CAS with write back throttling enabled on exported object description: | Fill cache with data, run intensive IO (rwmix=74) with occasional trims. pass_criteria: - Hang task did not occurred - System did not crashed """ with TestRun.step("Prepare devices."): cache_device = TestRun.disks["cache"] core_device = TestRun.disks["core"] set_wbt_lat(cache_device, 0) set_wbt_lat(core_device, 0) if core_device.size < cache_device.size: TestRun.LOGGER.info("Starting cache on partition") cache_device.create_partitions([core_device.size]) cache_device = cache_device.partitions[0] with TestRun.step( f"Start cache with one core in write back with 64k cache line, NOP and disabled seq cutoff" ): cache = casadm.start_cache(cache_device, CacheMode.WB, CacheLineSize.LINE_64KiB) cache.set_cleaning_policy(CleaningPolicy.nop) core = cache.add_core(core_device) cache.set_seq_cutoff_policy(SeqCutOffPolicy.never) with TestRun.step("Check wbt_lat value on exported object"): wbt_lat_val = get_wbt_lat(core) TestRun.LOGGER.info(f"wbt_lat for exported object is {wbt_lat_val}") if wbt_lat_val == 0: TestRun.LOGGER.info(f"Setting wbt_lat for exported object to 75000us") set_wbt_lat(core, 75000) with TestRun.step("Fill cache with dirty data"): fio = get_fio_rw_cmd(core, write_percentage=100) fio_pid = fio.run_in_background() wait( lambda: core.get_statistics(percentage_val=True).usage_stats.dirty == 100, timeout=timedelta(hours=1), interval=timedelta(seconds=1), ) kill_all_io() with TestRun.step("Run fio with rwmix=74% and occasional trims"): get_fio_rw_cmd(core, write_percentage=74).run_in_background() get_fio_trim(core).run_in_background() with TestRun.step("Change cleaning policy to ACP"): cache.set_cleaning_policy(CleaningPolicy.acp) 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: # Instead of explicit sleeping with `time.sleep()` iostat is used for waiting iostat = IOstat.get_iostat_list( [core, cache_device, core_device], since_boot=False, interval=sleep_interval.total_seconds(), ) TestRun.LOGGER.debug(f"{iostat}") eta -= sleep_interval TestRun.LOGGER.debug(f"ETA: {str(eta)}") with TestRun.step("Stop all caches"): kill_all_io() casadm.stop_all_caches()