Skip to content

Commit 466fcbc

Browse files
author
Jan Musial
committed
Use cached device_ids
Signed-off-by: Jan Musial <[email protected]>
1 parent e7fd859 commit 466fcbc

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

test/functional/api/cas/cache.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright(c) 2019-2021 Intel Corporation
2+
# Copyright(c) 2019-2022 Intel Corporation
33
# SPDX-License-Identifier: BSD-3-Clause
44
#
55

@@ -17,12 +17,12 @@ def __init__(self, device: Device):
1717
self.__metadata_size = None
1818

1919
def __get_cache_id(self):
20-
cmd = f"{list_cmd(by_id_path=False)} | grep {self.cache_device.get_device_id()}"
20+
cmd = f"{list_cmd(by_id_path=False)} | grep {self.cache_device.device_id}"
2121
output = TestRun.executor.run(cmd)
2222
if output.exit_code == 0 and output.stdout.strip():
2323
return output.stdout.split()[1]
2424
else:
25-
raise Exception(f"There is no cache started on {self.cache_device.get_device_id()}.")
25+
raise Exception(f"There is no cache started on {self.cache_device.device_id}.")
2626

2727
def get_core_devices(self):
2828
return get_cores(self.cache_id)

test/functional/tests/cli/test_zero_metadata_command.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright(c) 2021 Intel Corporation
2+
# Copyright(c) 2021-2022 Intel Corporation
33
# SPDX-License-Identifier: BSD-3-Clause
44
#
55
import time
@@ -110,7 +110,7 @@ def test_zero_metadata_filesystem(filesystem):
110110
except CmdException as e:
111111
cli_messages.check_stderr_msg(e.output, cli_messages.no_cas_metadata)
112112

113-
file_system = get_device_filesystem_type(core.get_device_id())
113+
file_system = get_device_filesystem_type(core.device_id)
114114

115115
if file_system != filesystem:
116116
TestRun.LOGGER.error(f"Incorrect filesystem: {file_system}; expected: {filesystem}")

test/functional/tests/misc/test_device_capabilities.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright(c) 2020-2021 Intel Corporation
2+
# Copyright(c) 2020-2022 Intel Corporation
33
# SPDX-License-Identifier: BSD-3-Clause
44
#
55

@@ -32,7 +32,7 @@ def test_device_capabilities():
3232
"""
3333

3434
core_device = TestRun.disks['core']
35-
max_io_size_path = os.path.join(disk_utils.get_sysfs_path(core_device.get_device_id()),
35+
max_io_size_path = os.path.join(disk_utils.get_sysfs_path(core_device.device_id),
3636
'queue/max_sectors_kb')
3737
default_max_io_size = fs_utils.read_file(max_io_size_path)
3838

@@ -104,8 +104,8 @@ def create_scsi_debug_device(sector_size: int, physblk_exp: int, dev_size_mb=102
104104
def prepare_cas_device(cache_device, core_device):
105105
cache = casadm.start_cache(cache_device, cache_line_size=CacheLineSize.LINE_64KiB, force=True)
106106
try:
107-
cache_dev_bs = disk_utils.get_block_size(cache_device.get_device_id())
108-
core_dev_bs = disk_utils.get_block_size(core_device.get_device_id())
107+
cache_dev_bs = disk_utils.get_block_size(cache_device.device_id)
108+
core_dev_bs = disk_utils.get_block_size(core_device.device_id)
109109
core = cache.add_core(core_device)
110110
if cache_dev_bs > core_dev_bs:
111111
TestRun.LOGGER.error(
@@ -145,8 +145,8 @@ def method_lcm_not_zero(a, b):
145145

146146
def measure_capabilities(dev):
147147
dev_capabilities = {}
148-
dev_id = dev.parent_device.get_device_id() if isinstance(dev, Partition) \
149-
else dev.get_device_id()
148+
dev_id = dev.parent_device.device_id if isinstance(dev, Partition) \
149+
else dev.device_id
150150
for c in capabilities:
151151
path = os.path.join(disk_utils.get_sysfs_path(dev_id), 'queue', c)
152152
command = f"cat {path}"
@@ -165,10 +165,10 @@ def compare_capabilities(cache_device, core_device, cache, core, msg):
165165
cli_messages.try_add_core_sector_size_mismatch)
166166
else:
167167
core_dev_sectors_num = \
168-
disk_utils.get_size(core_device.get_device_id()) / disk_utils.get_block_size(
169-
core_device.get_device_id())
170-
core_sectors_num = disk_utils.get_size(core.get_device_id()) / disk_utils.get_block_size(
171-
core.get_device_id())
168+
disk_utils.get_size(core_device.device_id) / disk_utils.get_block_size(
169+
core_device.device_id)
170+
core_sectors_num = disk_utils.get_size(core.device_id) / disk_utils.get_block_size(
171+
core.device_id)
172172
if core_dev_sectors_num != core_sectors_num:
173173
TestRun.LOGGER.error(
174174
"Number of sectors in CAS device and attached core device is different.")

0 commit comments

Comments
 (0)