Exemple #1
0
def get_wbt_lat(device: Device):
    wbt_lat_config_path = os.path.join(get_sysfs_path(device.get_device_id()),
                                       "queue/wbt_lat_usec")

    return int(
        TestRun.executor.run_expect_success(
            f"cat {wbt_lat_config_path}").stdout)
Exemple #2
0
 def set_sysfs_property(self, property_name, value):
     TestRun.LOGGER.info(
         f"Setting {property_name} for device {self.get_device_id()} to {value}."
     )
     path = os.path.join(disk_utils.get_sysfs_path(self.get_device_id()),
                         "queue", property_name)
     fs_utils.write_file(path, str(value))
Exemple #3
0
def set_wbt_lat(device: Device, value: int):
    if value < 0:
        raise ValueError("Write back latency can't be negative number")

    wbt_lat_config_path = os.path.join(get_sysfs_path(device.get_device_id()),
                                       "queue/wbt_lat_usec")

    return TestRun.executor.run_expect_success(
        f"echo {value} > {wbt_lat_config_path}")
def test_device_capabilities():
    """
        title: Test whether CAS device capabilities are properly set.
        description: |
          Test if CAS device takes into consideration differences between devices which are used to
          create it.
        pass_criteria:
          - CAS device starts successfully using differently configured devices.
          - CAS device capabilities are as expected.
    """

    core_device = TestRun.disks['core']
    max_io_size_path = os.path.join(disk_utils.get_sysfs_path(core_device.get_device_id()),
                                    'queue/max_sectors_kb')
    default_max_io_size = fs_utils.read_file(max_io_size_path)

    iteration_settings = [
        {"device": "SCSI-debug module",
         "dev_size_mb": 1024, "logical_block_size": 512, "max_sectors_kb": 1024},
        {"device": "SCSI-debug module",
         "dev_size_mb": 1024, "logical_block_size": 512, "max_sectors_kb": 256},
        {"device": "SCSI-debug module",
         "dev_size_mb": 1024, "logical_block_size": 512, "max_sectors_kb": 128},
        {"device": "SCSI-debug module",
         "dev_size_mb": 2048, "logical_block_size": 2048, "max_sectors_kb": 1024},
        {"device": "standard core device",
         "max_sectors_kb": int(default_max_io_size)},
        {"device": "standard core device", "max_sectors_kb": 128}
    ]

    for i in range(0, len(iteration_settings)):
        device = iteration_settings[i]["device"]
        group_title = f"{device} | "
        if device == "SCSI-debug module":
            group_title += f"dev_size_mb = {iteration_settings[i]['dev_size_mb']} | " \
                           f"logical_block_size = {iteration_settings[i]['logical_block_size']} | "
        group_title += f"max_sectors_kb = {iteration_settings[i]['max_sectors_kb']}"

        with TestRun.group(group_title):
            with TestRun.step("Prepare devices."):
                core_device = prepare_core_device(iteration_settings[i])
                cache_device = TestRun.disks['cache']

            with TestRun.step("Start cache and add prepared core device as core."):
                cache, core, error_output = prepare_cas_device(cache_device, core_device)
            with TestRun.step("Compare capabilities for CAS device, cache and core "
                              "(or check proper error if logical sector mismatch occurs)."):
                compare_capabilities(cache_device, core_device, cache, core, error_output)
            with TestRun.step("Recreate CAS device with switched cache and core devices."):
                cache, core, error_output = prepare_cas_device(core_device, cache_device)
            with TestRun.step("Compare capabilities for CAS device, cache and core "
                              "(or check proper error if logical sector mismatch occurs)."):
                compare_capabilities(core_device, cache_device, cache, core, error_output)
def measure_capabilities(dev):
    dev_capabilities = {}
    dev_id = dev.parent_device.get_device_id() if isinstance(dev, Partition) \
        else dev.get_device_id()
    for c in capabilities:
        path = os.path.join(disk_utils.get_sysfs_path(dev_id), 'queue', c)
        command = f"cat {path}"
        output = TestRun.executor.run(command)
        if output.exit_code == 0:
            val = int(output.stdout)
            dev_capabilities.update({c: val})
        else:
            TestRun.LOGGER.info(f"Could not measure capability: {c} for {dev_id}")
    return dev_capabilities
Exemple #6
0
 def get_sysfs_property(self, property_name):
     path = os.path.join(disk_utils.get_sysfs_path(self.get_device_id()),
                         "queue", property_name)
     return TestRun.executor.run_expect_success(f"cat {path}").stdout