Fix tests after LVM API refactor
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
parent
eb50ee5f5d
commit
6e3ac806b7
@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@ -16,6 +17,7 @@ from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||
from test_utils.size import Size, Unit
|
||||
from tests.volumes.common import lvm_filters
|
||||
|
||||
mount_point = "/mnt/"
|
||||
io_target = "/mnt/test"
|
||||
@ -43,16 +45,14 @@ def test_io_class_lvm_on_cas():
|
||||
cache = casadm.start_cache(cache_dev.partitions[0], CacheMode.WB, force=True)
|
||||
core = cache.add_core(core_dev.partitions[0])
|
||||
|
||||
with TestRun.step("Create LVM on CAS device."):
|
||||
lvm_filters = ["a/.*/", "r|/dev/sd*|", "r|/dev/hd*|", "r|/dev/xvd*|", "r/disk/", "r/block/",
|
||||
"r|/dev/nvme*|"]
|
||||
with TestRun.step("Add CAS device type to the LVM config file."):
|
||||
LvmConfiguration.add_block_device_to_lvm_config("cas")
|
||||
|
||||
with TestRun.step("Create LVM on CAS device."):
|
||||
config = LvmConfiguration(lvm_filters,
|
||||
pv_num=1,
|
||||
vg_num=1,
|
||||
lv_num=1,
|
||||
cache_num=1,
|
||||
cas_dev_num=1)
|
||||
lv_num=1,)
|
||||
|
||||
lvms = Lvm.create_specific_lvm_configuration(core, config)
|
||||
lvm = lvms[0]
|
||||
|
@ -1,12 +1,20 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
from api.cas.init_config import InitConfig, opencas_conf_path
|
||||
from test_tools import fs_utils
|
||||
from core.test_run import TestRun
|
||||
from test_utils.os_utils import get_block_device_names_list
|
||||
from test_utils.size import Size, Unit
|
||||
|
||||
test_file_size = Size(500, Unit.KiloByte)
|
||||
lvm_filters = [
|
||||
"a/.*/", "r|/dev/sd*|", "r|/dev/hd*|", "r|/dev/xvd*|", "r/disk/", "r/block/",
|
||||
"r|/dev/nvme*|", "r|/dev/vd*|"
|
||||
]
|
||||
|
||||
|
||||
def create_files_with_md5sums(destination_path, files_count):
|
||||
@ -40,3 +48,11 @@ def compare_md5sums(md5_sums_source, files_to_check_path, copy_to_tmp=False):
|
||||
TestRun.fail(f"Source and target files {file_to_check_path} checksums are different.")
|
||||
|
||||
TestRun.LOGGER.info(f"Successful verification, md5sums match.")
|
||||
|
||||
|
||||
def get_test_configuration():
|
||||
InitConfig.create_init_config_from_running_configuration()
|
||||
config_output = TestRun.executor.run(f"cat {opencas_conf_path}")
|
||||
devices = get_block_device_names_list(exclude_list=[7]) # 7 stands for loop device
|
||||
|
||||
return config_output.stdout, devices
|
||||
|
@ -1,11 +1,12 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
from api.cas.init_config import InitConfig, opencas_conf_path
|
||||
from storage_devices.lvm import Lvm, LvmConfiguration
|
||||
from api.cas import casadm
|
||||
from core.test_run import TestRun
|
||||
@ -13,6 +14,7 @@ from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
|
||||
from test_utils.size import Size, Unit
|
||||
from tests.volumes.common import get_test_configuration
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@ -36,15 +38,17 @@ def test_many_cores_on_many_lvms():
|
||||
cache_dev = cache_device.partitions[0]
|
||||
core_dev = core_device.partitions[0]
|
||||
|
||||
with TestRun.step("Configure LVM to use device filters."):
|
||||
LvmConfiguration.set_use_devices_file(False)
|
||||
|
||||
with TestRun.step("Create LVMs."):
|
||||
config = LvmConfiguration(lvm_filters=[],
|
||||
pv_num=1,
|
||||
vg_num=1,
|
||||
lv_num=16,
|
||||
cache_num=1,
|
||||
cas_dev_num=16)
|
||||
)
|
||||
|
||||
lvms = Lvm.create_specific_lvm_configuration([core_dev], config, lvm_as_core=True)
|
||||
lvms = Lvm.create_specific_lvm_configuration([core_dev], config)
|
||||
|
||||
with TestRun.step(f"Create CAS device."):
|
||||
cache = casadm.start_cache(cache_dev, force=True)
|
||||
@ -102,20 +106,3 @@ def test_many_cores_on_many_lvms():
|
||||
|
||||
with TestRun.step("Remove LVMs."):
|
||||
Lvm.remove_all()
|
||||
|
||||
|
||||
def get_block_devices_list():
|
||||
cmd = f"lsblk -l | awk '{{print $1}}' | grep -v loop"
|
||||
devices = TestRun.executor.run_expect_success(cmd).stdout
|
||||
devices_list = devices.splitlines()
|
||||
devices_list.sort()
|
||||
|
||||
return devices_list
|
||||
|
||||
|
||||
def get_test_configuration():
|
||||
InitConfig.create_init_config_from_running_configuration()
|
||||
config_output = TestRun.executor.run(f"cat {opencas_conf_path}")
|
||||
devices = get_block_devices_list()
|
||||
|
||||
return config_output.stdout, devices
|
||||
|
@ -1,19 +1,20 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
from api.cas.init_config import InitConfig, opencas_conf_path
|
||||
from storage_devices.lvm import Lvm, LvmConfiguration
|
||||
|
||||
from api.cas import casadm
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
|
||||
from test_utils.size import Size, Unit
|
||||
from tests.volumes.common import get_test_configuration, lvm_filters
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@ -48,16 +49,18 @@ def test_many_lvms_on_many_cores():
|
||||
for core_dev in core_partitions:
|
||||
cores.append(cache.add_core(core_dev))
|
||||
|
||||
with TestRun.step("Create LVMs on CAS device."):
|
||||
lvm_filters = ["a/.*/", "r|/dev/sd*|", "r|/dev/hd*|", "r|/dev/xvd*|", "r/disk/", "r/block/",
|
||||
"r|/dev/nvme*|"]
|
||||
with TestRun.step("Configure LVM to use device filters."):
|
||||
LvmConfiguration.set_use_devices_file(False)
|
||||
|
||||
with TestRun.step("Add CAS device type to the LVM config file."):
|
||||
LvmConfiguration.add_block_device_to_lvm_config("cas")
|
||||
|
||||
with TestRun.step("Create LVMs on CAS device."):
|
||||
config = LvmConfiguration(lvm_filters,
|
||||
pv_num=4,
|
||||
vg_num=4,
|
||||
lv_num=4,
|
||||
cache_num=1,
|
||||
cas_dev_num=len(cores))
|
||||
)
|
||||
|
||||
lvms = Lvm.create_specific_lvm_configuration(cores, config)
|
||||
|
||||
@ -108,20 +111,3 @@ def test_many_lvms_on_many_cores():
|
||||
with TestRun.step("Remove LVMs and clean up config changes."):
|
||||
Lvm.remove_all()
|
||||
LvmConfiguration.remove_filters_from_config()
|
||||
|
||||
|
||||
def get_block_devices_list():
|
||||
cmd = f"lsblk -l | awk '{{print $1}}' | grep -v loop"
|
||||
devices = TestRun.executor.run_expect_success(cmd).stdout
|
||||
devices_list = devices.splitlines()
|
||||
devices_list.sort()
|
||||
|
||||
return devices_list
|
||||
|
||||
|
||||
def get_test_configuration():
|
||||
InitConfig.create_init_config_from_running_configuration()
|
||||
config_output = TestRun.executor.run(f"cat {opencas_conf_path}")
|
||||
devices = get_block_devices_list()
|
||||
|
||||
return config_output.stdout, devices
|
||||
|
@ -1,19 +1,20 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
from api.cas.init_config import InitConfig, opencas_conf_path
|
||||
from storage_devices.lvm import Lvm, LvmConfiguration
|
||||
|
||||
from api.cas import casadm
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
|
||||
from test_utils.size import Size, Unit
|
||||
from tests.volumes.common import get_test_configuration, lvm_filters
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@ -38,16 +39,17 @@ def test_many_lvms_on_single_core():
|
||||
cache = casadm.start_cache(cache_dev.partitions[0], force=True)
|
||||
core = cache.add_core(core_dev.partitions[0])
|
||||
|
||||
with TestRun.step("Create LVMs on CAS device."):
|
||||
lvm_filters = ["a/.*/", "r|/dev/sd*|", "r|/dev/hd*|", "r|/dev/xvd*|", "r/disk/", "r/block/",
|
||||
"r|/dev/nvme*|"]
|
||||
with TestRun.step("Configure LVM to use device filters."):
|
||||
LvmConfiguration.set_use_devices_file(False)
|
||||
|
||||
with TestRun.step("Add CAS device type to the LVM config file."):
|
||||
LvmConfiguration.add_block_device_to_lvm_config("cas")
|
||||
|
||||
with TestRun.step("Create LVMs on CAS device."):
|
||||
config = LvmConfiguration(lvm_filters,
|
||||
pv_num=1,
|
||||
vg_num=1,
|
||||
lv_num=16,
|
||||
cache_num=1,
|
||||
cas_dev_num=1)
|
||||
lv_num=2,)
|
||||
|
||||
lvms = Lvm.create_specific_lvm_configuration(core, config)
|
||||
|
||||
@ -97,20 +99,3 @@ def test_many_lvms_on_single_core():
|
||||
|
||||
with TestRun.step("Remove LVMs."):
|
||||
Lvm.remove_all()
|
||||
|
||||
|
||||
def get_block_devices_list():
|
||||
cmd = f"lsblk -l | awk '{{print $1}}' | grep -v loop"
|
||||
devices = TestRun.executor.run_expect_success(cmd).stdout
|
||||
devices_list = devices.splitlines()
|
||||
devices_list.sort()
|
||||
|
||||
return devices_list
|
||||
|
||||
|
||||
def get_test_configuration():
|
||||
InitConfig.create_init_config_from_running_configuration()
|
||||
config_output = TestRun.executor.run(f"cat {opencas_conf_path}")
|
||||
devices = get_block_devices_list()
|
||||
|
||||
return config_output.stdout, devices
|
||||
|
Loading…
Reference in New Issue
Block a user