test-conftest: Use cached device_ids + fix posix path
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
4626d87471
commit
ed85411750
@ -174,8 +174,8 @@ def base_prepare(item):
|
||||
# stop only those RAIDs, which are comprised of test disks
|
||||
if all(map(lambda device:
|
||||
any(map(lambda disk_path:
|
||||
disk_path in device.get_device_id(),
|
||||
[bd.get_device_id() for bd in TestRun.dut.disks])),
|
||||
disk_path in device.device_id,
|
||||
[bd.device_id for bd in TestRun.dut.disks])),
|
||||
raid.array_devices)):
|
||||
raid.remove_partitions()
|
||||
raid.unmount()
|
||||
|
@ -32,12 +32,11 @@ def test_device_capabilities():
|
||||
- CAS device starts successfully using differently configured devices.
|
||||
- CAS device capabilities are as expected.
|
||||
"""
|
||||
|
||||
core_device = TestRun.disks['core']
|
||||
max_io_size_path = posixpath.join(disk_utils.get_sysfs_path(core_device.get_device_id()),
|
||||
'queue/max_sectors_kb')
|
||||
core_device = TestRun.disks["core"]
|
||||
max_io_size_path = posixpath.join(
|
||||
disk_utils.get_sysfs_path(core_device.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},
|
||||
@ -106,8 +105,8 @@ def create_scsi_debug_device(sector_size: int, physblk_exp: int, dev_size_mb=102
|
||||
def prepare_cas_device(cache_device, core_device):
|
||||
cache = casadm.start_cache(cache_device, cache_line_size=CacheLineSize.LINE_64KiB, force=True)
|
||||
try:
|
||||
cache_dev_bs = disk_utils.get_block_size(cache_device.get_device_id())
|
||||
core_dev_bs = disk_utils.get_block_size(core_device.get_device_id())
|
||||
cache_dev_bs = disk_utils.get_block_size(cache_device.device_id)
|
||||
core_dev_bs = disk_utils.get_block_size(core_device.device_id)
|
||||
core = cache.add_core(core_device)
|
||||
if cache_dev_bs > core_dev_bs:
|
||||
TestRun.LOGGER.error(
|
||||
@ -147,8 +146,8 @@ capabilities = {"logical_block_size": max,
|
||||
|
||||
def measure_capabilities(dev):
|
||||
dev_capabilities = {}
|
||||
dev_id = dev.parent_device.get_device_id() if isinstance(dev, Partition) \
|
||||
else dev.get_device_id()
|
||||
dev_id = dev.parent_device.device_id if isinstance(dev, Partition) \
|
||||
else dev.device_id
|
||||
for c in capabilities:
|
||||
path = posixpath.join(disk_utils.get_sysfs_path(dev_id), 'queue', c)
|
||||
command = f"cat {path}"
|
||||
@ -167,10 +166,10 @@ def compare_capabilities(cache_device, core_device, cache, core, msg):
|
||||
cli_messages.try_add_core_sector_size_mismatch)
|
||||
else:
|
||||
core_dev_sectors_num = \
|
||||
disk_utils.get_size(core_device.get_device_id()) / disk_utils.get_block_size(
|
||||
core_device.get_device_id())
|
||||
core_sectors_num = disk_utils.get_size(core.get_device_id()) / disk_utils.get_block_size(
|
||||
core.get_device_id())
|
||||
disk_utils.get_size(core_device.device_id) / disk_utils.get_block_size(
|
||||
core_device.device_id)
|
||||
core_sectors_num = disk_utils.get_size(core.device_id) / disk_utils.get_block_size(
|
||||
core.device_id)
|
||||
if core_dev_sectors_num != core_sectors_num:
|
||||
TestRun.LOGGER.error(
|
||||
"Number of sectors in CAS device and attached core device is different.")
|
||||
|
Loading…
Reference in New Issue
Block a user