예제 #1
0
def prepare(cache_mode: CacheMode):
    ioclass_config.remove_ioclass_config()
    cache_device = TestRun.disks['cache']
    core_device = TestRun.disks['core']

    cache_device.create_partitions([Size(500, Unit.MebiByte)])
    core_device.create_partitions([
        Size(1, Unit.GibiByte),
        Size(1, Unit.GibiByte),
        Size(1, Unit.GibiByte)
    ])

    cache_device = cache_device.partitions[0]
    core_device_1 = core_device.partitions[0]
    core_device_2 = core_device.partitions[1]
    core_device_3 = core_device.partitions[2]

    Udev.disable()

    TestRun.LOGGER.info(f"Starting cache")
    cache = casadm.start_cache(cache_device, cache_mode=cache_mode, force=True)
    TestRun.LOGGER.info(f"Setting cleaning policy to NOP")
    casadm.set_param_cleaning(cache_id=cache_id, policy=CleaningPolicy.nop)
    TestRun.LOGGER.info(f"Adding core devices")
    core_1 = cache.add_core(core_dev=core_device_1)
    core_2 = cache.add_core(core_dev=core_device_2)
    core_3 = cache.add_core(core_dev=core_device_3)

    output = TestRun.executor.run(f"mkdir -p {mountpoint}")
    if output.exit_code != 0:
        raise Exception(f"Failed to create mountpoint")

    return cache, [core_1, core_2, core_3]
예제 #2
0
def prepare(filesystem, cores_number):
    ioclass_config.remove_ioclass_config()
    cache_device = TestRun.disks["cache"]
    core_device = TestRun.disks["core"]

    cache_device.create_partitions([Size(10, Unit.GibiByte)])
    core_device.create_partitions([Size(5, Unit.GibiByte)] * cores_number)

    cache_device = cache_device.partitions[0]

    cache = casadm.start_cache(cache_device,
                               cache_mode=CacheMode.WT,
                               force=True)

    Udev.disable()
    casadm.set_param_cleaning(cache_id=cache.cache_id,
                              policy=CleaningPolicy.nop)

    cores = []
    for part in core_device.partitions:
        if filesystem:
            part.create_filesystem(filesystem)
        cores.append(casadm.add_core(cache, core_dev=part))

    cache.set_seq_cutoff_policy(SeqCutOffPolicy.never)

    ioclass_config.create_ioclass_config(
        add_default_rule=False,
        ioclass_config_path=ioclass_config.default_config_file_path)
    # To make test more precise all workload except of tested ioclass should be
    # put in pass-through mode
    ioclass_config.add_ioclass(
        ioclass_id=0,
        eviction_priority=22,
        allocation="1.00",
        rule="unclassified",
        ioclass_config_path=ioclass_config.default_config_file_path,
    )
    ioclass_config.add_ioclass(
        ioclass_id=1,
        eviction_priority=22,
        allocation="0.00",
        rule="metadata",
        ioclass_config_path=ioclass_config.default_config_file_path,
    )
    ioclass_config.add_ioclass(
        ioclass_id=2,
        eviction_priority=22,
        allocation="0.00",
        rule="direct",
        ioclass_config_path=ioclass_config.default_config_file_path,
    )

    return cache, cores
예제 #3
0
def prepare(
    cache_size=Size(500, Unit.MebiByte),
    core_size=Size(10, Unit.GibiByte),
    cache_mode=CacheMode.WB,
    cache_line_size=CacheLineSize.LINE_4KiB,
):
    ioclass_config.remove_ioclass_config()
    cache_device = TestRun.disks["cache"]
    core_device = TestRun.disks["core"]

    cache_device.create_partitions([cache_size])
    core_device.create_partitions([core_size])

    cache_device = cache_device.partitions[0]
    core_device = core_device.partitions[0]

    TestRun.LOGGER.info(f"Starting cache")
    cache = casadm.start_cache(cache_device,
                               cache_mode=cache_mode,
                               cache_line_size=cache_line_size,
                               force=True)

    Udev.disable()
    TestRun.LOGGER.info(f"Setting cleaning policy to NOP")
    casadm.set_param_cleaning(cache_id=cache.cache_id,
                              policy=CleaningPolicy.nop)
    TestRun.LOGGER.info(f"Adding core device")
    core = casadm.add_core(cache, core_dev=core_device)
    TestRun.LOGGER.info(f"Setting seq cutoff policy to never")
    core.set_seq_cutoff_policy(SeqCutOffPolicy.never)
    ioclass_config.create_ioclass_config(
        add_default_rule=False, ioclass_config_path=ioclass_config_path)
    # To make test more precise all workload except of tested ioclass should be
    # put in pass-through mode
    ioclass_config.add_ioclass(
        ioclass_id=ioclass_config.DEFAULT_IO_CLASS_ID,
        eviction_priority=ioclass_config.DEFAULT_IO_CLASS_PRIORITY,
        allocation="0.00",
        rule=ioclass_config.DEFAULT_IO_CLASS_RULE,
        ioclass_config_path=ioclass_config_path,
    )

    output = TestRun.executor.run(f"mkdir -p {mountpoint}")
    if output.exit_code != 0:
        raise Exception(f"Failed to create mountpoint")

    return cache, core
def prepare():
    base_prepare()
    ioclass_config.remove_ioclass_config()
    cache_device = next(
        filter(lambda disk: disk.disk_type in [DiskType.optane, DiskType.nand],
               TestRun.dut.disks))
    core_device = next(
        filter(
            lambda disk: disk.disk_type.value > cache_device.disk_type.value,
            TestRun.dut.disks))

    cache_device.create_partitions([Size(500, Unit.MebiByte)])
    core_device.create_partitions([Size(1, Unit.GibiByte)])

    cache_device = cache_device.partitions[0]
    core_device = core_device.partitions[0]

    TestRun.LOGGER.info(f"Starting cache")
    cache = casadm.start_cache(cache_device,
                               cache_mode=CacheMode.WB,
                               force=True)
    TestRun.LOGGER.info(f"Setting cleaning policy to NOP")
    casadm.set_param_cleaning(cache_id=cache.cache_id,
                              policy=CleaningPolicy.nop)
    TestRun.LOGGER.info(f"Adding core device")
    core = casadm.add_core(cache, core_dev=core_device)

    ioclass_config.create_ioclass_config(
        add_default_rule=False, ioclass_config_path=ioclass_config_path)
    # To make test more precise all workload except of tested ioclass should be
    # put in pass-through mode
    ioclass_config.add_ioclass(
        ioclass_id=0,
        eviction_priority=22,
        allocation=False,
        rule="unclassified",
        ioclass_config_path=ioclass_config_path,
    )

    output = TestRun.executor.run(f"mkdir -p {mountpoint}")
    if output.exit_code != 0:
        raise Exception(f"Failed to create mountpoint")

    return cache, core
예제 #5
0
def prepare():
    ioclass_config.remove_ioclass_config()
    cache_device = TestRun.disks['cache']
    core_device = TestRun.disks['core']

    cache_device.create_partitions([Size(500, Unit.MebiByte)])
    core_device.create_partitions([Size(1, Unit.GibiByte)])

    cache_device = cache_device.partitions[0]
    core_device = core_device.partitions[0]

    TestRun.LOGGER.info(f"Starting cache")
    cache = casadm.start_cache(cache_device, cache_mode=CacheMode.WB, force=True)

    Udev.disable()
    TestRun.LOGGER.info(f"Setting cleaning policy to NOP")
    casadm.set_param_cleaning(cache_id=cache.cache_id, policy=CleaningPolicy.nop)
    TestRun.LOGGER.info(f"Adding core device")
    core = casadm.add_core(cache, core_dev=core_device)
    core.set_seq_cutoff_policy(SeqCutOffPolicy.never)
    ioclass_config.create_ioclass_config(
        add_default_rule=False, ioclass_config_path=ioclass_config_path
    )
    # To make test more precise all workload except of tested ioclass should be
    # put in pass-through mode
    ioclass_config.add_ioclass(
        ioclass_id=0,
        eviction_priority=22,
        allocation=False,
        rule="unclassified",
        ioclass_config_path=ioclass_config_path,
    )

    output = TestRun.executor.run(f"mkdir -p {mountpoint}")
    if output.exit_code != 0:
        raise Exception(f"Failed to create mountpoint")

    return cache, core
예제 #6
0
def prepare(cache_mode: CacheMode):
    base_prepare()
    ioclass_config.remove_ioclass_config()
    cache_device = next(disk for disk in TestProperties.dut.disks
                        if disk.disk_type in [DiskType.optane, DiskType.nand])
    core_device = next(disk for disk in TestProperties.dut.disks
                       if (disk.disk_type.value > cache_device.disk_type.value
                           and disk != cache_device))

    cache_device.create_partitions([Size(500, Unit.MebiByte)])
    core_device.create_partitions([
        Size(1, Unit.GibiByte),
        Size(1, Unit.GibiByte),
        Size(1, Unit.GibiByte)
    ])

    cache_device = cache_device.partitions[0]
    core_device_1 = core_device.partitions[0]
    core_device_2 = core_device.partitions[1]
    core_device_3 = core_device.partitions[2]

    Udev.disable()

    TestProperties.LOGGER.info(f"Starting cache")
    cache = casadm.start_cache(cache_device, cache_mode=cache_mode, force=True)
    TestProperties.LOGGER.info(f"Setting cleaning policy to NOP")
    casadm.set_param_cleaning(cache_id=cache_id, policy=CleaningPolicy.nop)
    TestProperties.LOGGER.info(f"Adding core devices")
    core_1 = cache.add_core(core_dev=core_device_1)
    core_2 = cache.add_core(core_dev=core_device_2)
    core_3 = cache.add_core(core_dev=core_device_3)

    output = TestProperties.executor.execute(f"mkdir -p {mountpoint}")
    if output.exit_code != 0:
        raise Exception(f"Failed to create mountpoint")

    return cache, [core_1, core_2, core_3]