Fix imports
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
parent
f7e7d3aa7f
commit
e740ce377f
@ -8,8 +8,8 @@ from api.cas.casadm_parser import *
|
|||||||
from api.cas.core import Core
|
from api.cas.core import Core
|
||||||
from api.cas.dmesg import get_metadata_size_on_device
|
from api.cas.dmesg import get_metadata_size_on_device
|
||||||
from api.cas.statistics import CacheStats, CacheIoClassStats
|
from api.cas.statistics import CacheStats, CacheIoClassStats
|
||||||
from test_tools.os_tools import *
|
|
||||||
from connection.utils.output import Output
|
from connection.utils.output import Output
|
||||||
|
from test_tools.os_tools import sync
|
||||||
|
|
||||||
|
|
||||||
class Cache:
|
class Cache:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from test_tools import os_tools
|
from test_tools.os_tools import unload_kernel_module, load_kernel_module
|
||||||
|
|
||||||
|
|
||||||
class CasModule(Enum):
|
class CasModule(Enum):
|
||||||
@ -14,12 +14,12 @@ class CasModule(Enum):
|
|||||||
|
|
||||||
|
|
||||||
def reload_all_cas_modules():
|
def reload_all_cas_modules():
|
||||||
os_tools.unload_kernel_module(CasModule.cache.value)
|
unload_kernel_module(CasModule.cache.value)
|
||||||
os_tools.load_kernel_module(CasModule.cache.value)
|
load_kernel_module(CasModule.cache.value)
|
||||||
|
|
||||||
|
|
||||||
def unload_all_cas_modules():
|
def unload_all_cas_modules():
|
||||||
os_tools.unload_kernel_module(CasModule.cache.value)
|
unload_kernel_module(CasModule.cache.value)
|
||||||
|
|
||||||
|
|
||||||
def is_cas_management_dev_present():
|
def is_cas_management_dev_present():
|
||||||
|
@ -8,7 +8,6 @@ from datetime import timedelta
|
|||||||
from typing import List
|
from typing import List
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import SeqCutOffParameters, SeqCutOffPolicy
|
from api.cas.cache_config import SeqCutOffParameters, SeqCutOffPolicy
|
||||||
from api.cas.casadm_params import StatsFilter
|
from api.cas.casadm_params import StatsFilter
|
||||||
@ -16,7 +15,7 @@ from api.cas.casadm_parser import get_seq_cut_off_parameters, get_core_info_for_
|
|||||||
from api.cas.statistics import CoreStats, CoreIoClassStats
|
from api.cas.statistics import CoreStats, CoreIoClassStats
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
from test_tools import fs_tools, disk_tools
|
from test_tools.fs_tools import Filesystem, ls_item
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.common.wait import wait
|
from test_tools.common.wait import wait
|
||||||
from type_def.size import Unit, Size
|
from type_def.size import Unit, Size
|
||||||
@ -51,7 +50,7 @@ class Core(Device):
|
|||||||
return get_core_info_for_cache_by_path(core_disk_path=self.core_device.path,
|
return get_core_info_for_cache_by_path(core_disk_path=self.core_device.path,
|
||||||
target_cache_id=self.cache_id)
|
target_cache_id=self.cache_id)
|
||||||
|
|
||||||
def create_filesystem(self, fs_type: test_tools.fs_utils.Filesystem, force=True, blocksize=None):
|
def create_filesystem(self, fs_type: Filesystem, force=True, blocksize=None):
|
||||||
super().create_filesystem(fs_type, force, blocksize)
|
super().create_filesystem(fs_type, force, blocksize)
|
||||||
self.core_device.filesystem = self.filesystem
|
self.core_device.filesystem = self.filesystem
|
||||||
|
|
||||||
@ -140,7 +139,7 @@ class Core(Device):
|
|||||||
def check_if_is_present_in_os(self, should_be_visible=True):
|
def check_if_is_present_in_os(self, should_be_visible=True):
|
||||||
device_in_system_message = "CAS device exists in OS."
|
device_in_system_message = "CAS device exists in OS."
|
||||||
device_not_in_system_message = "CAS device does not exist in OS."
|
device_not_in_system_message = "CAS device does not exist in OS."
|
||||||
item = fs_utils.ls_item(f"{self.path}")
|
item = ls_item(self.path)
|
||||||
if item is not None:
|
if item is not None:
|
||||||
if should_be_visible:
|
if should_be_visible:
|
||||||
TestRun.LOGGER.info(device_in_system_message)
|
TestRun.LOGGER.info(device_in_system_message)
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
from api.cas import casadm_parser
|
from api.cas import casadm_parser
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import remove, write_file
|
||||||
|
|
||||||
|
|
||||||
opencas_conf_path = "/etc/opencas/opencas.conf"
|
opencas_conf_path = "/etc/opencas/opencas.conf"
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ class InitConfig:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_config_file():
|
def remove_config_file():
|
||||||
fs_utils.remove(opencas_conf_path, force=False)
|
remove(opencas_conf_path, force=False)
|
||||||
|
|
||||||
def save_config_file(self):
|
def save_config_file(self):
|
||||||
config_lines = []
|
config_lines = []
|
||||||
@ -47,7 +46,7 @@ class InitConfig:
|
|||||||
config_lines.append(CoreConfigLine.header)
|
config_lines.append(CoreConfigLine.header)
|
||||||
for c in self.core_config_lines:
|
for c in self.core_config_lines:
|
||||||
config_lines.append(str(c))
|
config_lines.append(str(c))
|
||||||
fs_utils.write_file(opencas_conf_path, "\n".join(config_lines), False)
|
write_file(opencas_conf_path, "\n".join(config_lines), False)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_init_config_from_running_configuration(
|
def create_init_config_from_running_configuration(
|
||||||
@ -69,7 +68,7 @@ class InitConfig:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def create_default_init_config(cls):
|
def create_default_init_config(cls):
|
||||||
cas_version = casadm_parser.get_casadm_version()
|
cas_version = casadm_parser.get_casadm_version()
|
||||||
fs_utils.write_file(opencas_conf_path, f"version={cas_version.base}")
|
write_file(opencas_conf_path, f"version={cas_version.base}")
|
||||||
|
|
||||||
|
|
||||||
class CacheConfigLine:
|
class CacheConfigLine:
|
||||||
|
@ -9,7 +9,7 @@ import os
|
|||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from api.cas import cas_module
|
from api.cas import cas_module
|
||||||
from api.cas.version import get_installed_cas_version
|
from api.cas.version import get_installed_cas_version
|
||||||
from test_tools import git, os_tools
|
from test_tools import git
|
||||||
from connection.utils.output import CmdException
|
from connection.utils.output import CmdException
|
||||||
from test_tools.os_tools import is_kernel_module_loaded
|
from test_tools.os_tools import is_kernel_module_loaded
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from datetime import timedelta
|
|||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import write_file
|
||||||
from test_tools.os_tools import get_kernel_version
|
from test_tools.os_tools import get_kernel_version
|
||||||
|
|
||||||
default_config_file_path = "/tmp/opencas_ioclass.conf"
|
default_config_file_path = "/tmp/opencas_ioclass.conf"
|
||||||
@ -108,7 +108,7 @@ class IoClass:
|
|||||||
ioclass_config_path: str = default_config_file_path,
|
ioclass_config_path: str = default_config_file_path,
|
||||||
):
|
):
|
||||||
TestRun.LOGGER.info(f"Creating config file {ioclass_config_path}")
|
TestRun.LOGGER.info(f"Creating config file {ioclass_config_path}")
|
||||||
fs_utils.write_file(
|
write_file(
|
||||||
ioclass_config_path, IoClass.list_to_csv(ioclass_list, add_default_rule)
|
ioclass_config_path, IoClass.list_to_csv(ioclass_list, add_default_rule)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e656aa1e5fdb2c5b063baf0307c58b50ab1d24c4
|
Subproject commit f7f2914e41ce73d13dafe6cd749aa6e2d33b4315
|
@ -12,8 +12,7 @@ from core.test_run import TestRun
|
|||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet
|
from storage_devices.disk import DiskType, DiskTypeSet
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, remove, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||||
@ -52,8 +51,8 @@ def test_support_different_io_size(cache_mode):
|
|||||||
cache.load_io_class(opencas_ioclass_conf_path)
|
cache.load_io_class(opencas_ioclass_conf_path)
|
||||||
|
|
||||||
with TestRun.step("Create a filesystem on the core device and mount it"):
|
with TestRun.step("Create a filesystem on the core device and mount it"):
|
||||||
fs_utils.remove(path=mountpoint, force=True, recursive=True, ignore_errors=True)
|
remove(path=mountpoint, force=True, recursive=True, ignore_errors=True)
|
||||||
fs_utils.create_directory(path=mountpoint)
|
create_directory(path=mountpoint)
|
||||||
core.create_filesystem(Filesystem.xfs)
|
core.create_filesystem(Filesystem.xfs)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
|
@ -17,9 +17,8 @@ from api.cas.cli_messages import (
|
|||||||
)
|
)
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, read_file
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
from connection.utils.output import CmdException
|
from connection.utils.output import CmdException
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -45,7 +44,7 @@ def test_cas_version():
|
|||||||
cmd_cas_versions = [version.split(",")[1] for version in cmd_version.split("\n")[1:]]
|
cmd_cas_versions = [version.split(",")[1] for version in cmd_version.split("\n")[1:]]
|
||||||
|
|
||||||
with TestRun.step(f"Read cas version from {version_file_path} location"):
|
with TestRun.step(f"Read cas version from {version_file_path} location"):
|
||||||
file_read = fs_utils.read_file(version_file_path).split("\n")
|
file_read = read_file(version_file_path).split("\n")
|
||||||
file_cas_version = next(
|
file_cas_version = next(
|
||||||
(line.split("=")[1] for line in file_read if "CAS_VERSION=" in line)
|
(line.split("=")[1] for line in file_read if "CAS_VERSION=" in line)
|
||||||
)
|
)
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
@ -47,7 +45,7 @@ def test_remove_core_when_other_mounted_auto_numeration():
|
|||||||
free_core = cache.add_core(core_device.partitions[0])
|
free_core = cache.add_core(core_device.partitions[0])
|
||||||
mounted_cores = []
|
mounted_cores = []
|
||||||
for i, part in enumerate(core_device.partitions[1:]):
|
for i, part in enumerate(core_device.partitions[1:]):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
part.create_filesystem(Filesystem.xfs)
|
||||||
mounted_cores.append(cache.add_core(part))
|
mounted_cores.append(cache.add_core(part))
|
||||||
mounted_cores[i].mount(
|
mounted_cores[i].mount(
|
||||||
mount_point=f"{mount_point}{cache.cache_id}-{mounted_cores[i].core_id}"
|
mount_point=f"{mount_point}{cache.cache_id}-{mounted_cores[i].core_id}"
|
||||||
@ -91,7 +89,7 @@ def test_remove_core_when_other_mounted_custom_numeration():
|
|||||||
|
|
||||||
mounted_cores = []
|
mounted_cores = []
|
||||||
for i, part in enumerate(core_device.partitions[1:]):
|
for i, part in enumerate(core_device.partitions[1:]):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
part.create_filesystem(Filesystem.xfs)
|
||||||
mounted_cores.append(
|
mounted_cores.append(
|
||||||
cache.add_core(core_dev=part, core_id=int(f"{random_prefix}{random_interfix}{i}"))
|
cache.add_core(core_dev=part, core_id=int(f"{random_prefix}{random_interfix}{i}"))
|
||||||
)
|
)
|
||||||
|
@ -10,7 +10,6 @@ from time import sleep
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import (
|
from api.cas.cache_config import (
|
||||||
CacheMode,
|
CacheMode,
|
||||||
@ -223,7 +222,7 @@ def test_multistream_seq_cutoff_stress_fs(streams_seq_rand, filesystem, cache_mo
|
|||||||
with TestRun.step("Create filesystem on core device"):
|
with TestRun.step("Create filesystem on core device"):
|
||||||
cache_disk = TestRun.disks["cache"]
|
cache_disk = TestRun.disks["cache"]
|
||||||
core_disk = TestRun.disks["core"]
|
core_disk = TestRun.disks["core"]
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_disk.create_filesystem(filesystem)
|
||||||
|
|
||||||
with TestRun.step("Start cache and add core"):
|
with TestRun.step("Start cache and add core"):
|
||||||
cache = casadm.start_cache(cache_dev=cache_disk, cache_mode=cache_mode, force=True)
|
cache = casadm.start_cache(cache_dev=cache_disk, cache_mode=cache_mode, force=True)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, casadm_parser, dmesg
|
from api.cas import casadm, casadm_parser, dmesg
|
||||||
from api.cas.casadm import standby_init
|
from api.cas.casadm import standby_init
|
||||||
from api.cas.cli import casadm_bin, standby_init_cmd
|
from api.cas.cli import casadm_bin, standby_init_cmd
|
||||||
@ -558,7 +557,7 @@ def test_standby_init_with_preexisting_filesystem(filesystem):
|
|||||||
cache_id = 1
|
cache_id = 1
|
||||||
|
|
||||||
with TestRun.step("Create filesystem on cache device partition"):
|
with TestRun.step("Create filesystem on cache device partition"):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
cache_device.create_filesystem(filesystem)
|
||||||
|
|
||||||
with TestRun.step("Try initialize cache without force flag"):
|
with TestRun.step("Try initialize cache without force flag"):
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ from datetime import timedelta
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, cli_messages, cli
|
from api.cas import casadm, cli_messages, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -99,7 +98,7 @@ def test_zero_metadata_filesystem(filesystem):
|
|||||||
cache_dev, core_disk, cache_disk = prepare_devices()
|
cache_dev, core_disk, cache_disk = prepare_devices()
|
||||||
|
|
||||||
with TestRun.step("Create filesystem on core device."):
|
with TestRun.step("Create filesystem on core device."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_disk.create_filesystem(filesystem)
|
||||||
|
|
||||||
with TestRun.step("Start cache and add core."):
|
with TestRun.step("Start cache and add core."):
|
||||||
cache = casadm.start_cache(cache_dev, force=True)
|
cache = casadm.start_cache(cache_dev, force=True)
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright(c) 2021 Intel Corporation
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
#
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
from storage_devices.lvm import get_block_devices_list
|
|
||||||
|
|
||||||
from api.cas.init_config import InitConfig
|
|
||||||
from test_tools.fio.fio import Fio
|
|
||||||
from test_tools.fio.fio_param import IoEngine, ReadWrite, VerifyMethod
|
|
||||||
from type_def.size import Size, Unit
|
|
||||||
|
|
||||||
|
|
||||||
def run_fio_on_lvm(volumes: []):
|
|
||||||
fio_run = (Fio().create_command()
|
|
||||||
.read_write(ReadWrite.randrw)
|
|
||||||
.io_engine(IoEngine.sync)
|
|
||||||
.io_depth(1)
|
|
||||||
.time_based()
|
|
||||||
.run_time(datetime.timedelta(seconds=180))
|
|
||||||
.do_verify()
|
|
||||||
.verify(VerifyMethod.md5)
|
|
||||||
.block_size(Size(1, Unit.Blocks4096)))
|
|
||||||
for lvm in volumes:
|
|
||||||
fio_run.add_job().target(lvm).size(lvm.size)
|
|
||||||
fio_run.run()
|
|
||||||
|
|
||||||
|
|
||||||
def get_test_configuration():
|
|
||||||
config = InitConfig.create_init_config_from_running_configuration()
|
|
||||||
devices = get_block_devices_list()
|
|
||||||
|
|
||||||
return config, devices
|
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -12,12 +13,10 @@ import pytest
|
|||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory, check_if_directory_exists, md5sum
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
|
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_utils.filesystem.file import File
|
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from type_def.size import Unit, Size
|
from type_def.size import Unit, Size
|
||||||
|
|
||||||
@ -72,8 +71,8 @@ def test_data_integrity_5d_dss(filesystems):
|
|||||||
with TestRun.step("Create filesystems and mount cores"):
|
with TestRun.step("Create filesystems and mount cores"):
|
||||||
for i, core in enumerate(cores):
|
for i, core in enumerate(cores):
|
||||||
mount_point = core.path.replace('/dev/', '/mnt/')
|
mount_point = core.path.replace('/dev/', '/mnt/')
|
||||||
if not fs_utils.check_if_directory_exists(mount_point):
|
if not check_if_directory_exists(mount_point):
|
||||||
fs_utils.create_directory(mount_point)
|
create_directory(mount_point)
|
||||||
TestRun.LOGGER.info(f"Create filesystem {filesystems[i].name} on {core.path}")
|
TestRun.LOGGER.info(f"Create filesystem {filesystems[i].name} on {core.path}")
|
||||||
core.create_filesystem(filesystems[i])
|
core.create_filesystem(filesystems[i])
|
||||||
TestRun.LOGGER.info(f"Mount filesystem {filesystems[i].name} on {core.path} to "
|
TestRun.LOGGER.info(f"Mount filesystem {filesystems[i].name} on {core.path} to "
|
||||||
@ -106,14 +105,14 @@ def test_data_integrity_5d_dss(filesystems):
|
|||||||
core.unmount()
|
core.unmount()
|
||||||
|
|
||||||
with TestRun.step("Calculate md5 for each core"):
|
with TestRun.step("Calculate md5 for each core"):
|
||||||
core_md5s = [File(core.full_path).md5sum() for core in cores]
|
core_md5s = [md5sum(core.path) for core in cores]
|
||||||
|
|
||||||
with TestRun.step("Stop caches"):
|
with TestRun.step("Stop caches"):
|
||||||
for cache in caches:
|
for cache in caches:
|
||||||
cache.stop()
|
cache.stop()
|
||||||
|
|
||||||
with TestRun.step("Calculate md5 for each core"):
|
with TestRun.step("Calculate md5 for each core"):
|
||||||
dev_md5s = [File(dev.full_path).md5sum() for dev in core_devices]
|
dev_md5s = [md5sum(dev.full_path) for dev in core_devices]
|
||||||
|
|
||||||
with TestRun.step("Compare md5 sums for cores and core devices"):
|
with TestRun.step("Compare md5 sums for cores and core devices"):
|
||||||
for core_md5, dev_md5, mode, fs in zip(core_md5s, dev_md5s, cache_modes, filesystems):
|
for core_md5, dev_md5, mode, fs in zip(core_md5s, dev_md5s, cache_modes, filesystems):
|
||||||
@ -171,14 +170,14 @@ def test_data_integrity_5d():
|
|||||||
fio_run.run()
|
fio_run.run()
|
||||||
|
|
||||||
with TestRun.step("Calculate md5 for each core"):
|
with TestRun.step("Calculate md5 for each core"):
|
||||||
core_md5s = [File(core.full_path).md5sum() for core in cores]
|
core_md5s = [md5sum(core.path) for core in cores]
|
||||||
|
|
||||||
with TestRun.step("Stop caches"):
|
with TestRun.step("Stop caches"):
|
||||||
for cache in caches:
|
for cache in caches:
|
||||||
cache.stop()
|
cache.stop()
|
||||||
|
|
||||||
with TestRun.step("Calculate md5 for each core"):
|
with TestRun.step("Calculate md5 for each core"):
|
||||||
dev_md5s = [File(dev.full_path).md5sum() for dev in core_devices]
|
dev_md5s = [md5sum(dev.full_path) for dev in core_devices]
|
||||||
|
|
||||||
with TestRun.step("Compare md5 sums for cores and core devices"):
|
with TestRun.step("Compare md5 sums for cores and core devices"):
|
||||||
for core_md5, dev_md5, mode in zip(core_md5s, dev_md5s, cache_modes):
|
for core_md5, dev_md5, mode in zip(core_md5s, dev_md5s, cache_modes):
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet
|
from storage_devices.disk import DiskType, DiskTypeSet
|
||||||
from storage_devices.raid import Raid, RaidConfiguration, MetadataVariant, Level
|
from storage_devices.raid import Raid, RaidConfiguration, MetadataVariant, Level
|
||||||
@ -14,8 +14,8 @@ from storage_devices.ramdisk import RamDisk
|
|||||||
from test_utils.drbd import Resource, Node
|
from test_utils.drbd import Resource, Node
|
||||||
from storage_devices.drbd import Drbd
|
from storage_devices.drbd import Drbd
|
||||||
from test_tools.drbdadm import Drbdadm
|
from test_tools.drbdadm import Drbdadm
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import copy, Filesystem, replace_in_lines, remove, Permissions, \
|
||||||
from test_tools.fs_tools import copy, Filesystem
|
PermissionsUsers
|
||||||
from test_utils.filesystem.directory import Directory
|
from test_utils.filesystem.directory import Directory
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -52,7 +52,7 @@ def test_create_example_partitions():
|
|||||||
test_disk.create_partitions(part_sizes)
|
test_disk.create_partitions(part_sizes)
|
||||||
for i in TestRun.iteration(range(0, 5)):
|
for i in TestRun.iteration(range(0, 5)):
|
||||||
with TestRun.step(f"Create filesystem on partition {i}"):
|
with TestRun.step(f"Create filesystem on partition {i}"):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
test_disk.partitions[i].create_filesystem(Filesystem.ext3)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.require_disk("cache1", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
@pytest.mark.require_disk("cache1", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
@ -102,7 +102,7 @@ def test_create_example_files():
|
|||||||
content_before_change = file1.read()
|
content_before_change = file1.read()
|
||||||
TestRun.LOGGER.info(f"File content: {content_before_change}")
|
TestRun.LOGGER.info(f"File content: {content_before_change}")
|
||||||
with TestRun.step("Replace single line in file"):
|
with TestRun.step("Replace single line in file"):
|
||||||
fs_utils.replace_in_lines(file1, 'content line', 'replaced line')
|
replace_in_lines(file1, 'content line', 'replaced line')
|
||||||
with TestRun.step("Read file content and check if it changed"):
|
with TestRun.step("Read file content and check if it changed"):
|
||||||
content_after_change = file1.read()
|
content_after_change = file1.read()
|
||||||
if content_before_change == content_after_change:
|
if content_before_change == content_after_change:
|
||||||
@ -115,19 +115,19 @@ def test_create_example_files():
|
|||||||
with TestRun.step("Change permissions of second file"):
|
with TestRun.step("Change permissions of second file"):
|
||||||
file2.chmod_numerical(123)
|
file2.chmod_numerical(123)
|
||||||
with TestRun.step("Remove second file"):
|
with TestRun.step("Remove second file"):
|
||||||
fs_utils.remove(file2.full_path, True)
|
remove(file2.full_path, True)
|
||||||
|
|
||||||
with TestRun.step("List contents of home directory"):
|
with TestRun.step("List contents of home directory"):
|
||||||
dir1 = Directory("~")
|
dir1 = Directory("~")
|
||||||
dir_content = dir1.ls()
|
dir_content = dir1.ls()
|
||||||
with TestRun.step("Change permissions of file"):
|
with TestRun.step("Change permissions of file"):
|
||||||
file1.chmod(fs_utils.Permissions['r'] | fs_utils.Permissions['w'],
|
file1.chmod(Permissions['r'] | Permissions['w'],
|
||||||
fs_utils.PermissionsUsers(7))
|
PermissionsUsers(7))
|
||||||
with TestRun.step("Log home directory content"):
|
with TestRun.step("Log home directory content"):
|
||||||
for item in dir_content:
|
for item in dir_content:
|
||||||
TestRun.LOGGER.info(f"Item {str(item)} - {type(item).__name__}")
|
TestRun.LOGGER.info(f"Item {str(item)} - {type(item).__name__}")
|
||||||
with TestRun.step("Remove file"):
|
with TestRun.step("Remove file"):
|
||||||
fs_utils.remove(file1.full_path, True)
|
remove(file1.full_path, True)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.require_disk("cache1", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
@pytest.mark.require_disk("cache1", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta, datetime
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -1094,13 +1095,6 @@ def test_failover_io_long(cls, cleaning_policy, num_iterations):
|
|||||||
TestRun.executor.wait_for_connection()
|
TestRun.executor.wait_for_connection()
|
||||||
|
|
||||||
|
|
||||||
def check_drbd_installed(duts):
|
|
||||||
for dut in duts:
|
|
||||||
with TestRun.use_dut(dut):
|
|
||||||
if not Drbd.is_installed():
|
|
||||||
TestRun.fail(f"DRBD is not installed on DUT {dut.ip}")
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_devices(duts):
|
def prepare_devices(duts):
|
||||||
for dut in duts:
|
for dut in duts:
|
||||||
with TestRun.use_dut(dut):
|
with TestRun.use_dut(dut):
|
||||||
|
@ -23,12 +23,11 @@ from storage_devices.raid import Raid, RaidConfiguration, MetadataVariant, Level
|
|||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite
|
from test_tools.fio.fio_param import ReadWrite
|
||||||
from test_tools.fs_tools import readlink, Filesystem
|
from test_tools.fs_tools import readlink, Filesystem, create_directory
|
||||||
from test_utils.drbd import Resource, Node
|
from test_utils.drbd import Resource, Node
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
from test_tools import fs_tools
|
|
||||||
|
|
||||||
|
|
||||||
cache_id = 5
|
cache_id = 5
|
||||||
@ -145,7 +144,7 @@ def test_functional_activate_twice_round_trip(filesystem):
|
|||||||
primary_node.cache.set_seq_cutoff_policy(SeqCutOffPolicy.never)
|
primary_node.cache.set_seq_cutoff_policy(SeqCutOffPolicy.never)
|
||||||
if filesystem:
|
if filesystem:
|
||||||
TestRun.executor.run(f"rm -rf {mountpoint}")
|
TestRun.executor.run(f"rm -rf {mountpoint}")
|
||||||
fs_utils.create_directory(path=mountpoint)
|
create_directory(path=mountpoint)
|
||||||
core.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
@ -316,7 +315,7 @@ def test_functional_activate_twice_new_host(filesystem):
|
|||||||
primary_node.cache.set_seq_cutoff_policy(SeqCutOffPolicy.never)
|
primary_node.cache.set_seq_cutoff_policy(SeqCutOffPolicy.never)
|
||||||
if filesystem:
|
if filesystem:
|
||||||
TestRun.executor.run(f"rm -rf {mountpoint}")
|
TestRun.executor.run(f"rm -rf {mountpoint}")
|
||||||
fs_utils.create_directory(path=mountpoint)
|
create_directory(path=mountpoint)
|
||||||
core.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
@ -492,7 +491,7 @@ def failover_sequence(standby_node, drbd_resource, filesystem, core):
|
|||||||
if filesystem:
|
if filesystem:
|
||||||
with TestRun.use_dut(standby_node), TestRun.step(f"Mount core"):
|
with TestRun.use_dut(standby_node), TestRun.step(f"Mount core"):
|
||||||
TestRun.executor.run(f"rm -rf {mountpoint}")
|
TestRun.executor.run(f"rm -rf {mountpoint}")
|
||||||
fs_utils.create_directory(path=mountpoint)
|
create_directory(path=mountpoint)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, casadm_parser, cli
|
from api.cas import casadm, casadm_parser, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
||||||
from api.cas.casadm_parser import wait_for_flushing
|
from api.cas.casadm_parser import wait_for_flushing
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_random_test_file
|
||||||
from test_tools.os_tools import DropCachesMode, sync, drop_caches
|
from test_tools.os_tools import DropCachesMode, sync, drop_caches
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -55,7 +53,7 @@ def test_interrupt_core_flush(cache_mode, filesystem):
|
|||||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||||
|
|
||||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_part.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
@ -139,7 +137,7 @@ def test_interrupt_cache_flush(cache_mode, filesystem):
|
|||||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||||
|
|
||||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_part.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
@ -226,7 +224,7 @@ def test_interrupt_core_remove(cache_mode, filesystem):
|
|||||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||||
|
|
||||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it"):
|
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it"):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_part.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
@ -343,7 +341,7 @@ def test_interrupt_cache_mode_switch_parametrized(cache_mode, stop_percentage):
|
|||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
|
|
||||||
with TestRun.step(f"Create test file in mount point of exported object"):
|
with TestRun.step(f"Create test file in mount point of exported object"):
|
||||||
test_file = fs_utils.create_random_test_file(test_file_path, test_file_size)
|
test_file = create_random_test_file(test_file_path, test_file_size)
|
||||||
|
|
||||||
with TestRun.step("Calculate md5sum of test file"):
|
with TestRun.step("Calculate md5sum of test file"):
|
||||||
test_file_md5_before = test_file.md5sum()
|
test_file_md5_before = test_file.md5sum()
|
||||||
@ -443,7 +441,7 @@ def test_interrupt_cache_stop(cache_mode, filesystem):
|
|||||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||||
|
|
||||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_part.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ def test_one_core_fail_dirty():
|
|||||||
with TestRun.step("Check if core device is really out of cache."):
|
with TestRun.step("Check if core device is really out of cache."):
|
||||||
output = str(casadm.list_caches().stdout.splitlines())
|
output = str(casadm.list_caches().stdout.splitlines())
|
||||||
if core_part1.path in output:
|
if core_part1.path in output:
|
||||||
TestRun.exception("The first core device should be unplugged!")
|
TestRun.LOGGER.exception("The first core device should be unplugged!")
|
||||||
|
|
||||||
with TestRun.step("Verify that I/O to the remaining cores does not insert to cache"):
|
with TestRun.step("Verify that I/O to the remaining cores does not insert to cache"):
|
||||||
dd_builder(cache_mode, core2, Size(100, Unit.MebiByte)).run()
|
dd_builder(cache_mode, core2, Size(100, Unit.MebiByte)).run()
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.udev
|
|
||||||
from api.cas import casadm, casadm_parser, cli, cli_messages
|
from api.cas import casadm, casadm_parser, cli, cli_messages
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
||||||
|
from test_tools.fs_tools import create_random_test_file
|
||||||
|
from test_tools.udev import Udev
|
||||||
from tests.lazy_writes.recovery.recovery_tests_methods import copy_file, compare_files
|
from tests.lazy_writes.recovery.recovery_tests_methods import copy_file, compare_files
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
mount_point = "/mnt/cas"
|
mount_point = "/mnt/cas"
|
||||||
@ -46,7 +47,7 @@ def test_stop_no_flush_load_cache(cache_mode):
|
|||||||
|
|
||||||
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
||||||
test_file_size = Size(48, Unit.MebiByte)
|
test_file_size = Size(48, Unit.MebiByte)
|
||||||
test_file = fs_utils.create_random_test_file(test_file_path, test_file_size)
|
test_file = create_random_test_file(test_file_path, test_file_size)
|
||||||
test_file_md5_before = test_file.md5sum()
|
test_file_md5_before = test_file.md5sum()
|
||||||
copy_file(source=test_file.full_path, target=core.path, size=test_file_size,
|
copy_file(source=test_file.full_path, target=core.path, size=test_file_size,
|
||||||
direct="oflag")
|
direct="oflag")
|
||||||
@ -99,5 +100,5 @@ def prepare():
|
|||||||
core_dev = TestRun.disks['core']
|
core_dev = TestRun.disks['core']
|
||||||
core_dev.create_partitions([Size(2, Unit.GibiByte)])
|
core_dev.create_partitions([Size(2, Unit.GibiByte)])
|
||||||
core_part = core_dev.partitions[0]
|
core_part = core_dev.partitions[0]
|
||||||
test_tools.udev.Udev.disable()
|
Udev.disable()
|
||||||
return cache_part, core_part
|
return cache_part, core_part
|
||||||
|
@ -6,12 +6,11 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, casadm_parser, cli, cli_messages
|
from api.cas import casadm, casadm_parser, cli, cli_messages
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools, disk_tools
|
from test_tools.disk_tools import get_block_size, create_partitions
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_random_test_file, check_if_file_exists
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
from test_utils.filesystem.symlink import Symlink
|
from test_utils.filesystem.symlink import Symlink
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -42,12 +41,12 @@ def test_load_cache_with_mounted_core():
|
|||||||
cache = casadm.start_cache(cache_part, force=True)
|
cache = casadm.start_cache(cache_part, force=True)
|
||||||
|
|
||||||
with TestRun.step("Add core device with xfs filesystem to cache and mount it."):
|
with TestRun.step("Add core device with xfs filesystem to cache and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_part.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
||||||
test_file = fs_utils.create_random_test_file(test_file_path)
|
test_file = create_random_test_file(test_file_path)
|
||||||
test_file_md5_before = test_file.md5sum()
|
test_file_md5_before = test_file.md5sum()
|
||||||
|
|
||||||
with TestRun.step("Unmount core device."):
|
with TestRun.step("Unmount core device."):
|
||||||
@ -111,13 +110,13 @@ def test_stop_cache_with_mounted_partition():
|
|||||||
core2 = cache.add_core(core_dev2)
|
core2 = cache.add_core(core_dev2)
|
||||||
|
|
||||||
with TestRun.step("Create partitions on one exported object."):
|
with TestRun.step("Create partitions on one exported object."):
|
||||||
core.block_size = Size(disk_utils.get_block_size(core.get_device_id()))
|
core.block_size = Size(get_block_size(core.get_device_id()))
|
||||||
disk_utils.create_partitions(core, 2 * [Size(4, Unit.GibiByte)])
|
create_partitions(core, 2 * [Size(4, Unit.GibiByte)])
|
||||||
fs_part = core.partitions[0]
|
fs_part = core.partitions[0]
|
||||||
|
|
||||||
with TestRun.step("Create xfs filesystems on one exported object partition "
|
with TestRun.step("Create xfs filesystems on one exported object partition "
|
||||||
"and on the non-partitioned exported object."):
|
"and on the non-partitioned exported object."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
fs_part.create_filesystem(Filesystem.xfs)
|
||||||
core2.create_filesystem(Filesystem.xfs)
|
core2.create_filesystem(Filesystem.xfs)
|
||||||
|
|
||||||
with TestRun.step("Mount created filesystems."):
|
with TestRun.step("Mount created filesystems."):
|
||||||
@ -125,7 +124,7 @@ def test_stop_cache_with_mounted_partition():
|
|||||||
core2.mount(mount_point2)
|
core2.mount(mount_point2)
|
||||||
|
|
||||||
with TestRun.step("Ensure /etc/mtab exists."):
|
with TestRun.step("Ensure /etc/mtab exists."):
|
||||||
if not fs_utils.check_if_file_exists("/etc/mtab"):
|
if not check_if_file_exists("/etc/mtab"):
|
||||||
Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
||||||
|
|
||||||
with TestRun.step("Try to remove the core with partitions from cache."):
|
with TestRun.step("Try to remove the core with partitions from cache."):
|
||||||
@ -181,12 +180,12 @@ def test_stop_cache_with_mounted_partition_no_mtab():
|
|||||||
cache = casadm.start_cache(cache_part, force=True)
|
cache = casadm.start_cache(cache_part, force=True)
|
||||||
|
|
||||||
with TestRun.step("Add core device with xfs filesystem and mount it."):
|
with TestRun.step("Add core device with xfs filesystem and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_part.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
with TestRun.step("Move /etc/mtab"):
|
with TestRun.step("Move /etc/mtab"):
|
||||||
if fs_utils.check_if_file_exists("/etc/mtab"):
|
if check_if_file_exists("/etc/mtab"):
|
||||||
mtab = File("/etc/mtab")
|
mtab = File("/etc/mtab")
|
||||||
else:
|
else:
|
||||||
mtab = Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
mtab = Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli, cli_messages
|
from api.cas import casadm, cli, cli_messages
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.core import CoreStatus
|
from api.cas.core import CoreStatus
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -90,7 +90,7 @@ def test_core_pool_exclusive_open():
|
|||||||
core_disk = TestRun.disks["core"]
|
core_disk = TestRun.disks["core"]
|
||||||
core_disk.create_partitions([Size(1, Unit.GibiByte)])
|
core_disk.create_partitions([Size(1, Unit.GibiByte)])
|
||||||
core_dev = core_disk.partitions[0]
|
core_dev = core_disk.partitions[0]
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
core_dev.create_filesystem(Filesystem.ext4)
|
||||||
cache_id = 1
|
cache_id = 1
|
||||||
core_id = 1
|
core_id = 1
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ def test_core_pool_exclusive_open():
|
|||||||
with TestRun.step("Check if it is impossible to make filesystem on the core device "
|
with TestRun.step("Check if it is impossible to make filesystem on the core device "
|
||||||
"from core pool."):
|
"from core pool."):
|
||||||
try:
|
try:
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4, force=False)
|
core_dev.create_filesystem(Filesystem.ext4, force=False)
|
||||||
TestRun.fail("Successfully created filesystem on core from core pool, "
|
TestRun.fail("Successfully created filesystem on core from core pool, "
|
||||||
"this is unexpected behaviour.")
|
"this is unexpected behaviour.")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -12,9 +13,10 @@ from api.cas.cache_config import (CleaningPolicy,
|
|||||||
FlushParametersAlru,
|
FlushParametersAlru,
|
||||||
Time,
|
Time,
|
||||||
FlushParametersAcp)
|
FlushParametersAcp)
|
||||||
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import *
|
from test_tools.fio.fio_param import IoEngine, ReadWrite, CpusAllowedPolicy
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -7,7 +8,6 @@ import os
|
|||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import test_tools.runlevel
|
|
||||||
from api.cas import casadm, casadm_parser
|
from api.cas import casadm, casadm_parser
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from api.cas.init_config import InitConfig
|
from api.cas.init_config import InitConfig
|
||||||
@ -17,7 +17,7 @@ from test_tools.fs_tools import Filesystem
|
|||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||||
from test_tools.os_tools import sync, drop_caches
|
from test_tools.os_tools import sync, drop_caches
|
||||||
from test_tools.runlevel import Runlevel
|
from test_tools.runlevel import Runlevel, change_runlevel
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def test_init_reboot_runlevels(runlevel, cache_mode):
|
|||||||
- Cache should be loaded successfully after reboot.
|
- Cache should be loaded successfully after reboot.
|
||||||
"""
|
"""
|
||||||
with TestRun.step(f"Set runlevel to {runlevel.value}."):
|
with TestRun.step(f"Set runlevel to {runlevel.value}."):
|
||||||
test_tools.runlevel.change_runlevel(runlevel)
|
change_runlevel(runlevel)
|
||||||
|
|
||||||
with TestRun.step("Prepare CAS device."):
|
with TestRun.step("Prepare CAS device."):
|
||||||
cache_disk = TestRun.disks['cache']
|
cache_disk = TestRun.disks['cache']
|
||||||
@ -88,5 +88,5 @@ def test_init_reboot_runlevels(runlevel, cache_mode):
|
|||||||
with TestRun.step("Stop cache and set default runlevel."):
|
with TestRun.step("Stop cache and set default runlevel."):
|
||||||
if len(caches) != 0:
|
if len(caches) != 0:
|
||||||
casadm.stop_all_caches()
|
casadm.stop_all_caches()
|
||||||
test_tools.runlevel.change_runlevel(Runlevel.runlevel3)
|
change_runlevel(Runlevel.runlevel3)
|
||||||
TestRun.executor.reboot()
|
TestRun.executor.reboot()
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, casadm_parser, cli, cli_messages
|
from api.cas import casadm, casadm_parser, cli, cli_messages
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
|
@ -222,7 +222,7 @@ def test_cas_startup_lazy():
|
|||||||
|
|
||||||
core_pool_paths = {c["device_path"] for c in core_pool_list}
|
core_pool_paths = {c["device_path"] for c in core_pool_list}
|
||||||
if core_pool_paths != expected_core_pool_paths:
|
if core_pool_paths != expected_core_pool_paths:
|
||||||
TestRun.error(
|
TestRun.LOGGER.error(
|
||||||
f"Expected the following devices in core pool "
|
f"Expected the following devices in core pool "
|
||||||
f"{expected_core_pool_paths}. Got {core_pool_paths}"
|
f"{expected_core_pool_paths}. Got {core_pool_paths}"
|
||||||
)
|
)
|
||||||
@ -231,7 +231,7 @@ def test_cas_startup_lazy():
|
|||||||
|
|
||||||
caches_paths = {c["device_path"] for c in caches_list}
|
caches_paths = {c["device_path"] for c in caches_list}
|
||||||
if caches_paths != expected_caches_paths:
|
if caches_paths != expected_caches_paths:
|
||||||
TestRun.error(
|
TestRun.LOGGER.error(
|
||||||
f"Expected the following devices as caches "
|
f"Expected the following devices as caches "
|
||||||
f"{expected_caches_paths}. Got {caches_paths}"
|
f"{expected_caches_paths}. Got {caches_paths}"
|
||||||
)
|
)
|
||||||
@ -240,7 +240,7 @@ def test_cas_startup_lazy():
|
|||||||
|
|
||||||
cores_paths = {c["device_path"] for c in cores_list}
|
cores_paths = {c["device_path"] for c in cores_list}
|
||||||
if cores_paths != expected_cores_paths:
|
if cores_paths != expected_cores_paths:
|
||||||
TestRun.error(
|
TestRun.LOGGER.error(
|
||||||
f"Expected the following devices as cores "
|
f"Expected the following devices as cores "
|
||||||
f"{expected_caches_paths}. Got {cores_paths}"
|
f"{expected_caches_paths}. Got {cores_paths}"
|
||||||
)
|
)
|
||||||
@ -447,14 +447,14 @@ def test_failover_config_startup():
|
|||||||
cores_list = get_cas_devices_dict()["cores"].values()
|
cores_list = get_cas_devices_dict()["cores"].values()
|
||||||
|
|
||||||
if len(core_pool_list) != 0:
|
if len(core_pool_list) != 0:
|
||||||
TestRun.error(f"No cores expected in core pool. Got {core_pool_list}")
|
TestRun.LOGGER.error(f"No cores expected in core pool. Got {core_pool_list}")
|
||||||
else:
|
else:
|
||||||
TestRun.LOGGER.info("Core pool is ok")
|
TestRun.LOGGER.info("Core pool is ok")
|
||||||
|
|
||||||
expected_caches_paths = set([active_cache_path, standby_cache_path])
|
expected_caches_paths = set([active_cache_path, standby_cache_path])
|
||||||
caches_paths = {c["device"] for c in caches_list}
|
caches_paths = {c["device"] for c in caches_list}
|
||||||
if caches_paths != expected_caches_paths:
|
if caches_paths != expected_caches_paths:
|
||||||
TestRun.error(
|
TestRun.LOGGER.error(
|
||||||
f"Expected the following devices as caches "
|
f"Expected the following devices as caches "
|
||||||
f"{expected_caches_paths}. Got {caches_paths}"
|
f"{expected_caches_paths}. Got {caches_paths}"
|
||||||
)
|
)
|
||||||
@ -464,7 +464,7 @@ def test_failover_config_startup():
|
|||||||
expected_core_paths = set([active_core_path])
|
expected_core_paths = set([active_core_path])
|
||||||
cores_paths = {c["device"] for c in cores_list}
|
cores_paths = {c["device"] for c in cores_list}
|
||||||
if cores_paths != expected_core_paths:
|
if cores_paths != expected_core_paths:
|
||||||
TestRun.error(
|
TestRun.LOGGER.error(
|
||||||
f"Expected the following devices as cores "
|
f"Expected the following devices as cores "
|
||||||
f"{expected_core_paths}. Got {cores_paths}"
|
f"{expected_core_paths}. Got {cores_paths}"
|
||||||
)
|
)
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
from datetime import timedelta
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -48,7 +48,7 @@ def test_io_engines(cache_mode, filesystem, io_engine):
|
|||||||
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
||||||
|
|
||||||
TestRun.LOGGER.info(f"Create filesystem '{filesystem}' on '{core_dev.path}'")
|
TestRun.LOGGER.info(f"Create filesystem '{filesystem}' on '{core_dev.path}'")
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_dev.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
import os
|
|
||||||
|
|
||||||
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize, CacheModeTrait
|
from api.cas.cache_config import CacheMode, CacheLineSize, CacheModeTrait
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
@ -3,22 +3,20 @@
|
|||||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import posixpath
|
import posixpath
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from test_tools.os_tools import sync, drop_caches
|
from test_tools.os_tools import sync, drop_caches
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet
|
from storage_devices.disk import DiskType, DiskTypeSet
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.blktrace import BlkTrace, BlkTraceMask, RwbsKind
|
from test_tools.blktrace import BlkTrace, BlkTraceMask, RwbsKind
|
||||||
from test_tools.disk_tools import check_if_device_supports_trim
|
from test_tools.disk_tools import check_if_device_supports_trim
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_random_test_file
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -230,14 +228,14 @@ def test_trim_device_discard_support(
|
|||||||
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
||||||
cache.set_cleaning_policy(cleaning_policy)
|
cache.set_cleaning_policy(cleaning_policy)
|
||||||
|
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_dev.create_filesystem(filesystem)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
|
|
||||||
with TestRun.step("Mount filesystem with discard option."):
|
with TestRun.step("Mount filesystem with discard option."):
|
||||||
core.mount(mount_point, ["discard"])
|
core.mount(mount_point, ["discard"])
|
||||||
|
|
||||||
with TestRun.step("Create random file."):
|
with TestRun.step("Create random file."):
|
||||||
test_file = fs_utils.create_random_test_file(
|
test_file = create_random_test_file(
|
||||||
posixpath.join(mount_point, "test_file"), core_dev.size * 0.2
|
posixpath.join(mount_point, "test_file"), core_dev.size * 0.2
|
||||||
)
|
)
|
||||||
occupancy_before = core.get_occupancy()
|
occupancy_before = core.get_occupancy()
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from datetime import timedelta
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, ioclass_config
|
from api.cas import casadm, ioclass_config
|
||||||
@ -12,7 +12,7 @@ from api.cas.casadm_params import OutputFormat
|
|||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import read_file, remove
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
ioclass_config_path = "/tmp/opencas_ioclass.conf"
|
ioclass_config_path = "/tmp/opencas_ioclass.conf"
|
||||||
@ -61,7 +61,7 @@ def test_io_class_export_configuration():
|
|||||||
f"{casadm.list_io_classes_cmd(str(cache.cache_id), OutputFormat.csv.name)}"
|
f"{casadm.list_io_classes_cmd(str(cache.cache_id), OutputFormat.csv.name)}"
|
||||||
f" > {saved_config_path}"
|
f" > {saved_config_path}"
|
||||||
)
|
)
|
||||||
csv = fs_utils.read_file(saved_config_path)
|
csv = read_file(saved_config_path)
|
||||||
if not IoClass.compare_ioclass_lists(IoClass.csv_to_list(csv), random_list):
|
if not IoClass.compare_ioclass_lists(IoClass.csv_to_list(csv), random_list):
|
||||||
TestRun.LOGGER.error(
|
TestRun.LOGGER.error(
|
||||||
"Exported configuration does not match expected\n"
|
"Exported configuration does not match expected\n"
|
||||||
@ -98,7 +98,7 @@ def test_io_class_export_configuration():
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestRun.LOGGER.step(f"Test cleanup"):
|
with TestRun.LOGGER.step(f"Test cleanup"):
|
||||||
fs_utils.remove(saved_config_path)
|
remove(saved_config_path)
|
||||||
|
|
||||||
|
|
||||||
def prepare(cache_mode: CacheMode = None):
|
def prepare(cache_mode: CacheMode = None):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
from datetime import datetime
|
||||||
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_directory, remove
|
||||||
from test_utils.filesystem.directory import Directory
|
from test_utils.filesystem.directory import Directory
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
||||||
@ -47,19 +46,19 @@ def test_ioclass_directory_depth(filesystem):
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
with TestRun.step(f"Create the base directory: {base_dir_path}."):
|
with TestRun.step(f"Create the base directory: {base_dir_path}."):
|
||||||
fs_utils.create_directory(base_dir_path)
|
create_directory(base_dir_path)
|
||||||
|
|
||||||
with TestRun.step(f"Create a nested directory."):
|
with TestRun.step(f"Create a nested directory."):
|
||||||
nested_dir_path = base_dir_path
|
nested_dir_path = base_dir_path
|
||||||
random_depth = random.randint(40, 80)
|
random_depth = random.randint(40, 80)
|
||||||
for i in range(random_depth):
|
for i in range(random_depth):
|
||||||
nested_dir_path += f"/dir_{i}"
|
nested_dir_path += f"/dir_{i}"
|
||||||
fs_utils.create_directory(path=nested_dir_path, parents=True)
|
create_directory(path=nested_dir_path, parents=True)
|
||||||
|
|
||||||
# Test classification in nested dir by reading a previously unclassified file
|
# Test classification in nested dir by reading a previously unclassified file
|
||||||
with TestRun.step("Create the first file in the nested directory."):
|
with TestRun.step("Create the first file in the nested directory."):
|
||||||
@ -177,9 +176,9 @@ def test_ioclass_directory_file_operations(filesystem):
|
|||||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||||
|
|
||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem and mounting {core.path} at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(fs_type=filesystem)
|
core.create_filesystem(fs_type=filesystem)
|
||||||
core.mount(mount_point=mountpoint)
|
core.mount(mount_point=mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -347,7 +346,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(fs_type=filesystem)
|
core.create_filesystem(fs_type=filesystem)
|
||||||
core.mount(mount_point=mountpoint)
|
core.mount(mount_point=mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -399,7 +398,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestRun.step(f"Remove {classified_dir_path_2}."):
|
with TestRun.step(f"Remove {classified_dir_path_2}."):
|
||||||
fs_utils.remove(path=classified_dir_path_2, force=True, recursive=True)
|
remove(path=classified_dir_path_2, force=True, recursive=True)
|
||||||
sync()
|
sync()
|
||||||
drop_caches(DropCachesMode.ALL)
|
drop_caches(DropCachesMode.ALL)
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
from api.cas.ioclass_config import default_config_file_path
|
from api.cas.ioclass_config import default_config_file_path
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from math import isclose
|
from math import isclose
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from .io_class_common import *
|
from .io_class_common import *
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ def test_io_class_eviction_priority():
|
|||||||
|
|
||||||
with TestRun.step(f"Preparing filesystem and mounting {core.path} at {mountpoint}"):
|
with TestRun.step(f"Preparing filesystem and mounting {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ def test_io_class_eviction_priority():
|
|||||||
IoclassConfig(4, 1, 1.00, f"{mountpoint}/D"),
|
IoclassConfig(4, 1, 1.00, f"{mountpoint}/D"),
|
||||||
]
|
]
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Adding io classes for all dirs"):
|
with TestRun.step("Adding io classes for all dirs"):
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
@ -57,7 +56,7 @@ def test_ioclass_file_extension():
|
|||||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}."):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core.create_filesystem(Filesystem.ext3)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
with TestRun.step("Flush cache."):
|
with TestRun.step("Flush cache."):
|
||||||
@ -124,7 +123,7 @@ def test_ioclass_file_name_prefix():
|
|||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
previous_occupancy = cache.get_occupancy()
|
previous_occupancy = cache.get_occupancy()
|
||||||
|
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core.create_filesystem(Filesystem.ext3)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
current_occupancy = cache.get_occupancy()
|
current_occupancy = cache.get_occupancy()
|
||||||
@ -210,7 +209,7 @@ def test_ioclass_file_extension_preexisting_filesystem():
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare files on raw block device."):
|
with TestRun.step(f"Prepare files on raw block device."):
|
||||||
casadm.remove_core(cache.cache_id, core_id=core.core_id)
|
casadm.remove_core(cache.cache_id, core_id=core.core_id)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core.core_device.create_filesystem(Filesystem.ext3)
|
||||||
core.core_device.mount(mountpoint)
|
core.core_device.mount(mountpoint)
|
||||||
|
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
@ -292,7 +291,7 @@ def test_ioclass_file_offset():
|
|||||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}."):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core.create_filesystem(Filesystem.ext3)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
with TestRun.step("Flush cache."):
|
with TestRun.step("Flush cache."):
|
||||||
@ -384,7 +383,7 @@ def test_ioclass_file_size(filesystem):
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, ioclass_config
|
from api.cas import casadm, ioclass_config
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from storage_devices.lvm import Lvm, LvmConfiguration
|
from storage_devices.lvm import Lvm, LvmConfiguration
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, read_file, remove
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -59,11 +57,11 @@ def test_io_class_lvm_on_cas():
|
|||||||
lvm = lvms[0]
|
lvm = lvms[0]
|
||||||
|
|
||||||
with TestRun.step("Create filesystem for LVM and mount it."):
|
with TestRun.step("Create filesystem for LVM and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
lvm.create_filesystem(Filesystem.ext4)
|
||||||
lvm.mount(mount_point)
|
lvm.mount(mount_point)
|
||||||
|
|
||||||
with TestRun.step("Prepare and load IO class config."):
|
with TestRun.step("Prepare and load IO class config."):
|
||||||
io_classes = IoClass.csv_to_list(fs_utils.read_file("/etc/opencas/ioclass-config.csv"))
|
io_classes = IoClass.csv_to_list(read_file("/etc/opencas/ioclass-config.csv"))
|
||||||
# remove two firs elements/lines: unclassified and metadata
|
# remove two firs elements/lines: unclassified and metadata
|
||||||
io_classes.pop(1)
|
io_classes.pop(1)
|
||||||
io_classes.pop(0)
|
io_classes.pop(0)
|
||||||
@ -124,7 +122,7 @@ def test_io_class_lvm_on_cas():
|
|||||||
else:
|
else:
|
||||||
file_size = Size(1100, Unit.MebiByte)
|
file_size = Size(1100, Unit.MebiByte)
|
||||||
|
|
||||||
fs_utils.remove(io_target)
|
remove(io_target)
|
||||||
|
|
||||||
with TestRun.step("Remove LVMs."):
|
with TestRun.step("Remove LVMs."):
|
||||||
TestRun.executor.run(f"umount {mount_point}")
|
TestRun.executor.run(f"umount {mount_point}")
|
||||||
|
@ -4,19 +4,17 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from math import isclose
|
from math import isclose
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Unit, Size
|
from type_def.size import Unit, Size
|
||||||
@ -57,7 +55,7 @@ def test_io_class_occupancy_directory_write(io_size_multiplication, cache_mode):
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -70,7 +68,7 @@ def test_io_class_occupancy_directory_write(io_size_multiplication, cache_mode):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old ioclass config"):
|
with TestRun.step("Remove old ioclass config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
@ -187,7 +185,7 @@ def test_io_class_occupancy_directory_read(io_size_multiplication):
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -200,7 +198,7 @@ def test_io_class_occupancy_directory_read(io_size_multiplication):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"In each directory create file with size of {io_size_multiplication} "
|
f"In each directory create file with size of {io_size_multiplication} "
|
||||||
@ -317,7 +315,7 @@ def test_ioclass_occupancy_sum_cache():
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -331,7 +329,7 @@ def test_ioclass_occupancy_sum_cache():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old ioclass config"):
|
with TestRun.step("Remove old ioclass config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from math import isclose
|
from math import isclose
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from tests.io_class.io_class_common import (
|
from tests.io_class.io_class_common import (
|
||||||
@ -54,7 +53,7 @@ def test_ioclass_occupancy_load():
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ def test_ioclass_occupancy_load():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old ioclass config"):
|
with TestRun.step("Remove old ioclass config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from math import isclose
|
from math import isclose
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory, move
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Unit
|
from type_def.size import Unit
|
||||||
@ -56,7 +55,7 @@ def test_ioclass_repart(io_class_size_multiplication):
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ def test_ioclass_repart(io_class_size_multiplication):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old io class config"):
|
with TestRun.step("Remove old io class config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
@ -125,7 +124,7 @@ def test_ioclass_repart(io_class_size_multiplication):
|
|||||||
|
|
||||||
with TestRun.step("Force repart - move files to created directories and read theirs contents"):
|
with TestRun.step("Force repart - move files to created directories and read theirs contents"):
|
||||||
for i, io_class in enumerate(io_classes):
|
for i, io_class in enumerate(io_classes):
|
||||||
fs_utils.move(source=f"{mountpoint}/{i}", destination=io_class.dir_path)
|
move(source=f"{mountpoint}/{i}", destination=io_class.dir_path)
|
||||||
run_io_dir_read(f"{io_class.dir_path}/{i}")
|
run_io_dir_read(f"{io_class.dir_path}/{i}")
|
||||||
|
|
||||||
with TestRun.step("Check if each ioclass reached it's occupancy limit"):
|
with TestRun.step("Check if each ioclass reached it's occupancy limit"):
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from recordclass import recordclass
|
from recordclass import recordclass
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.os_tools import sync
|
from test_tools.os_tools import sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Unit
|
from type_def.size import Unit
|
||||||
@ -48,7 +48,7 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
|||||||
IoclassConfig = recordclass("IoclassConfig", "id eviction_prio max_occupancy dir_path")
|
IoclassConfig = recordclass("IoclassConfig", "id eviction_prio max_occupancy dir_path")
|
||||||
io_class = IoclassConfig(2, 3, 0.10, f"{mountpoint}/A")
|
io_class = IoclassConfig(2, 3, 0.10, f"{mountpoint}/A")
|
||||||
|
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old ioclass config"):
|
with TestRun.step("Remove old ioclass config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from math import isclose
|
from math import isclose
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
from .io_class_common import (
|
from .io_class_common import (
|
||||||
@ -44,7 +44,7 @@ def test_io_class_pinning_eviction():
|
|||||||
cache_line_count = cache.get_statistics().config_stats.cache_size
|
cache_line_count = cache.get_statistics().config_stats.cache_size
|
||||||
|
|
||||||
with TestRun.step("Mount filesystem"):
|
with TestRun.step("Mount filesystem"):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core.create_filesystem(Filesystem.xfs)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
with TestRun.step("Prepare test dirs"):
|
with TestRun.step("Prepare test dirs"):
|
||||||
@ -58,7 +58,7 @@ def test_io_class_pinning_eviction():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old config"):
|
with TestRun.step("Remove old config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
@ -141,7 +141,7 @@ def test_pinned_ioclasses_eviction():
|
|||||||
cache_line_count = cache.get_statistics().config_stats.cache_size
|
cache_line_count = cache.get_statistics().config_stats.cache_size
|
||||||
|
|
||||||
with TestRun.step("Mount filesystem"):
|
with TestRun.step("Mount filesystem"):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core.create_filesystem(Filesystem.xfs)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
with TestRun.step("Prepare test dirs"):
|
with TestRun.step("Prepare test dirs"):
|
||||||
@ -152,7 +152,7 @@ def test_pinned_ioclasses_eviction():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Remove old config"):
|
with TestRun.step("Remove old config"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -9,8 +10,8 @@ from api.cas import ioclass_config, cli_messages
|
|||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from connection.utils.output import CmdException
|
from connection.utils.output import CmdException
|
||||||
|
from test_tools.fs_tools import read_file, write_file
|
||||||
from type_def.size import Unit, Size
|
from type_def.size import Unit, Size
|
||||||
from tests.io_class.io_class_common import prepare, ioclass_config_path
|
from tests.io_class.io_class_common import prepare, ioclass_config_path
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ def test_io_class_prevent_wrong_configuration():
|
|||||||
f"{IoClass.default_header()}\n{loaded_io_classes_str}"
|
f"{IoClass.default_header()}\n{loaded_io_classes_str}"
|
||||||
)
|
)
|
||||||
|
|
||||||
config_io_classes = IoClass.csv_to_list(fs_utils.read_file(ioclass_config_path))
|
config_io_classes = IoClass.csv_to_list(read_file(ioclass_config_path))
|
||||||
if not IoClass.compare_ioclass_lists(config_io_classes, loaded_io_classes):
|
if not IoClass.compare_ioclass_lists(config_io_classes, loaded_io_classes):
|
||||||
TestRun.fail("Default IO class configuration not loaded correctly.")
|
TestRun.fail("Default IO class configuration not loaded correctly.")
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ def test_io_class_prevent_wrong_configuration():
|
|||||||
f"Preparing headerless configuration file with following content:\n"
|
f"Preparing headerless configuration file with following content:\n"
|
||||||
f"{headerless_configuration}"
|
f"{headerless_configuration}"
|
||||||
)
|
)
|
||||||
fs_utils.write_file(ioclass_config_path, headerless_configuration)
|
write_file(ioclass_config_path, headerless_configuration)
|
||||||
try_load_malformed_config(
|
try_load_malformed_config(
|
||||||
cache,
|
cache,
|
||||||
config_io_classes,
|
config_io_classes,
|
||||||
@ -114,7 +115,7 @@ def test_io_class_prevent_wrong_configuration():
|
|||||||
TestRun.LOGGER.info(
|
TestRun.LOGGER.info(
|
||||||
f"Testing following header with default IO class:\n" f"{config_content}"
|
f"Testing following header with default IO class:\n" f"{config_content}"
|
||||||
)
|
)
|
||||||
fs_utils.write_file(ioclass_config_path, config_content)
|
write_file(ioclass_config_path, config_content)
|
||||||
try_load_malformed_config(cache, config_io_classes, expected_err_msg=err_message)
|
try_load_malformed_config(cache, config_io_classes, expected_err_msg=err_message)
|
||||||
|
|
||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
@ -123,7 +124,7 @@ def test_io_class_prevent_wrong_configuration():
|
|||||||
):
|
):
|
||||||
config_content = f"{IoClass.default_header()}\n{double_io_class_configuration}"
|
config_content = f"{IoClass.default_header()}\n{double_io_class_configuration}"
|
||||||
TestRun.LOGGER.info(f"Testing following configuration file:\n{config_content}")
|
TestRun.LOGGER.info(f"Testing following configuration file:\n{config_content}")
|
||||||
fs_utils.write_file(ioclass_config_path, config_content)
|
write_file(ioclass_config_path, config_content)
|
||||||
try_load_malformed_config(
|
try_load_malformed_config(
|
||||||
cache,
|
cache,
|
||||||
config_io_classes,
|
config_io_classes,
|
||||||
@ -139,7 +140,7 @@ def test_io_class_prevent_wrong_configuration():
|
|||||||
TestRun.LOGGER.info(
|
TestRun.LOGGER.info(
|
||||||
f"Testing following header with default IO class:\n{config_content}"
|
f"Testing following header with default IO class:\n{config_content}"
|
||||||
)
|
)
|
||||||
fs_utils.write_file(ioclass_config_path, config_content)
|
write_file(ioclass_config_path, config_content)
|
||||||
try_load_malformed_config(cache, config_io_classes, expected_err_msg=err_message)
|
try_load_malformed_config(cache, config_io_classes, expected_err_msg=err_message)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
|
@ -4,17 +4,15 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
from collections import namedtuple
|
||||||
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_directory
|
||||||
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
||||||
from test_tools.udev import Udev
|
from test_tools.udev import Udev
|
||||||
from type_def.size import Unit, Size
|
from type_def.size import Unit, Size
|
||||||
@ -43,7 +41,7 @@ def test_ioclass_usage_sum():
|
|||||||
|
|
||||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||||
filesystem = Filesystem.xfs
|
filesystem = Filesystem.xfs
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -57,7 +55,7 @@ def test_ioclass_usage_sum():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for io_class in io_classes:
|
for io_class in io_classes:
|
||||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
create_directory(io_class.dir_path, parents=True)
|
||||||
|
|
||||||
with TestRun.step("Add io classes for all dirs"):
|
with TestRun.step("Add io classes for all dirs"):
|
||||||
ioclass_config.remove_ioclass_config()
|
ioclass_config.remove_ioclass_config()
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
import test_tools.runlevel
|
|
||||||
from api.cas import ioclass_config, casadm_parser
|
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from api.cas.casadm_params import StatsFilter
|
from api.cas.casadm_params import StatsFilter
|
||||||
|
from api.cas.casadm_parser import get_caches, get_cores
|
||||||
from api.cas.init_config import InitConfig
|
from api.cas.init_config import InitConfig
|
||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass, remove_ioclass_config, create_ioclass_config, \
|
||||||
|
add_ioclass
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, copy, read_file
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
||||||
from test_tools.os_tools import sync, drop_caches
|
from test_tools.os_tools import sync, drop_caches
|
||||||
from test_tools.runlevel import Runlevel
|
from test_tools.runlevel import Runlevel, change_runlevel
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
from tests.io_class.io_class_common import (
|
from tests.io_class.io_class_common import (
|
||||||
prepare,
|
prepare,
|
||||||
@ -52,7 +52,7 @@ def test_io_class_service_load(runlevel):
|
|||||||
run_io_dir_read(core.path)
|
run_io_dir_read(core.path)
|
||||||
|
|
||||||
with TestRun.step("Create ext4 filesystem on CAS device and mount it."):
|
with TestRun.step("Create ext4 filesystem on CAS device and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
core.create_filesystem(Filesystem.ext4)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
|
|
||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
@ -79,18 +79,18 @@ def test_io_class_service_load(runlevel):
|
|||||||
sync()
|
sync()
|
||||||
|
|
||||||
with TestRun.step(f"Reboot system to runlevel {runlevel}."):
|
with TestRun.step(f"Reboot system to runlevel {runlevel}."):
|
||||||
test_tools.runlevel.change_runlevel(runlevel)
|
change_runlevel(runlevel)
|
||||||
TestRun.executor.reboot()
|
TestRun.executor.reboot()
|
||||||
|
|
||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
"Check if CAS device loads properly - "
|
"Check if CAS device loads properly - "
|
||||||
"IO class configuration and statistics shall not change"
|
"IO class configuration and statistics shall not change"
|
||||||
):
|
):
|
||||||
caches = casadm_parser.get_caches()
|
caches = get_caches()
|
||||||
if len(caches) != 1:
|
if len(caches) != 1:
|
||||||
TestRun.fail("Cache did not start at boot time.")
|
TestRun.fail("Cache did not start at boot time.")
|
||||||
cache = caches[0]
|
cache = caches[0]
|
||||||
cores = casadm_parser.get_cores(cache.cache_id)
|
cores = get_cores(cache.cache_id)
|
||||||
if len(cores) != 1:
|
if len(cores) != 1:
|
||||||
TestRun.fail(f"Actual number of cores: {len(cores)}\nExpected number of cores: 1")
|
TestRun.fail(f"Actual number of cores: {len(cores)}\nExpected number of cores: 1")
|
||||||
core = cores[0]
|
core = cores[0]
|
||||||
@ -160,17 +160,17 @@ def run_io():
|
|||||||
|
|
||||||
|
|
||||||
def prepare_and_load_io_class_config(cache, metadata_not_cached=False):
|
def prepare_and_load_io_class_config(cache, metadata_not_cached=False):
|
||||||
ioclass_config.remove_ioclass_config()
|
remove_ioclass_config()
|
||||||
|
|
||||||
if metadata_not_cached:
|
if metadata_not_cached:
|
||||||
ioclass_config.create_ioclass_config(
|
create_ioclass_config(
|
||||||
add_default_rule=True, ioclass_config_path=ioclass_config_path
|
add_default_rule=True, ioclass_config_path=ioclass_config_path
|
||||||
)
|
)
|
||||||
ioclass_config.add_ioclass(1, "metadata&done", 1, "0.00", ioclass_config_path)
|
add_ioclass(1, "metadata&done", 1, "0.00", ioclass_config_path)
|
||||||
else:
|
else:
|
||||||
fs_utils.copy(template_config_path, ioclass_config_path)
|
copy(template_config_path, ioclass_config_path)
|
||||||
|
|
||||||
config_io_classes = IoClass.csv_to_list(fs_utils.read_file(ioclass_config_path))
|
config_io_classes = IoClass.csv_to_list(read_file(ioclass_config_path))
|
||||||
cache.load_io_class(ioclass_config_path)
|
cache.load_io_class(ioclass_config_path)
|
||||||
output_io_classes = cache.list_io_classes()
|
output_io_classes = cache.list_io_classes()
|
||||||
if not IoClass.compare_ioclass_lists(config_io_classes, output_io_classes):
|
if not IoClass.compare_ioclass_lists(config_io_classes, output_io_classes):
|
||||||
|
@ -13,8 +13,7 @@ from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
|||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, remove, read_file
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
||||||
from test_tools.os_tools import sync, drop_caches
|
from test_tools.os_tools import sync, drop_caches
|
||||||
@ -83,7 +82,7 @@ def test_io_class_stats_file_size_core_fs(cache_mode: CacheMode, filesystem: Fil
|
|||||||
issued_reqs_no = \
|
issued_reqs_no = \
|
||||||
result[0].write_requests_number() + result[0].read_requests_number()
|
result[0].write_requests_number() + result[0].read_requests_number()
|
||||||
check_statistics(cache, core, io_classes, io_class, issued_reqs_no)
|
check_statistics(cache, core, io_classes, io_class, issued_reqs_no)
|
||||||
fs_utils.remove(f"{core.mount_point}/*", force=True, recursive=True)
|
remove(f"{core.mount_point}/*", force=True, recursive=True)
|
||||||
|
|
||||||
size_min = size + Size(512, Unit.Byte)
|
size_min = size + Size(512, Unit.Byte)
|
||||||
|
|
||||||
@ -140,7 +139,7 @@ def test_io_class_stats_file_size_core_direct(cache_mode: CacheMode):
|
|||||||
issued_reqs_no = \
|
issued_reqs_no = \
|
||||||
result[0].write_requests_number() + result[0].read_requests_number()
|
result[0].write_requests_number() + result[0].read_requests_number()
|
||||||
check_statistics(cache, core, io_classes, io_class_direct, issued_reqs_no)
|
check_statistics(cache, core, io_classes, io_class_direct, issued_reqs_no)
|
||||||
fs_utils.remove(f"{core.path}/*", force=True, recursive=True)
|
remove(f"{core.path}/*", force=True, recursive=True)
|
||||||
|
|
||||||
size_min = size + Size(512, Unit.Byte)
|
size_min = size + Size(512, Unit.Byte)
|
||||||
|
|
||||||
@ -191,7 +190,7 @@ def check_statistics(cache, core, io_classes, tested_io_class, issued_reqs_no):
|
|||||||
|
|
||||||
|
|
||||||
def prepare_io_classes(cache):
|
def prepare_io_classes(cache):
|
||||||
template_io_classes = IoClass.csv_to_list(fs_utils.read_file(template_config_path))
|
template_io_classes = IoClass.csv_to_list(read_file(template_config_path))
|
||||||
test_io_classes = []
|
test_io_classes = []
|
||||||
|
|
||||||
for io_class in template_io_classes:
|
for io_class in template_io_classes:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
from itertools import permutations
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
from itertools import permutations
|
||||||
|
|
||||||
from api.cas import ioclass_config, casadm
|
from api.cas import ioclass_config, casadm
|
||||||
from api.cas.ioclass_config import IoClass
|
from api.cas.ioclass_config import IoClass
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
from test_tools.fs_tools import Filesystem
|
from test_tools.fs_tools import Filesystem, create_directory, remove, \
|
||||||
|
replace_first_pattern_occurrence
|
||||||
from test_tools.fio.fio import Fio
|
from test_tools.fio.fio import Fio
|
||||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
@ -233,7 +233,7 @@ def test_ioclass_direct(filesystem):
|
|||||||
f"Preparing {filesystem.name} filesystem and mounting {core.path} at"
|
f"Preparing {filesystem.name} filesystem and mounting {core.path} at"
|
||||||
f" {mountpoint}"
|
f" {mountpoint}"
|
||||||
)
|
)
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
else:
|
else:
|
||||||
@ -329,7 +329,7 @@ def test_ioclass_metadata(filesystem):
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ def test_ioclass_metadata(filesystem):
|
|||||||
|
|
||||||
with TestRun.step(f"Create directory {test_dir_path}."):
|
with TestRun.step(f"Create directory {test_dir_path}."):
|
||||||
requests_to_metadata_before = requests_to_metadata_after
|
requests_to_metadata_before = requests_to_metadata_after
|
||||||
fs_utils.create_directory(path=test_dir_path)
|
create_directory(path=test_dir_path)
|
||||||
|
|
||||||
TestRun.LOGGER.info(f"Moving test files into {test_dir_path}")
|
TestRun.LOGGER.info(f"Moving test files into {test_dir_path}")
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -388,7 +388,7 @@ def test_ioclass_metadata(filesystem):
|
|||||||
TestRun.fail("No requests to metadata while moving files!")
|
TestRun.fail("No requests to metadata while moving files!")
|
||||||
|
|
||||||
with TestRun.step(f"Remove {test_dir_path}."):
|
with TestRun.step(f"Remove {test_dir_path}."):
|
||||||
fs_utils.remove(path=test_dir_path, force=True, recursive=True)
|
remove(path=test_dir_path, force=True, recursive=True)
|
||||||
|
|
||||||
with TestRun.step("Check requests to metadata."):
|
with TestRun.step("Check requests to metadata."):
|
||||||
requests_to_metadata_after = cache.get_io_class_statistics(
|
requests_to_metadata_after = cache.get_io_class_statistics(
|
||||||
@ -475,9 +475,9 @@ def test_ioclass_id_as_condition():
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
fs_utils.create_directory(base_dir_path)
|
create_directory(base_dir_path)
|
||||||
sync()
|
sync()
|
||||||
# CAS needs some time to resolve directory to inode
|
# CAS needs some time to resolve directory to inode
|
||||||
time.sleep(ioclass_config.MAX_CLASSIFICATION_DELAY.seconds)
|
time.sleep(ioclass_config.MAX_CLASSIFICATION_DELAY.seconds)
|
||||||
@ -616,10 +616,10 @@ def test_ioclass_conditions_or():
|
|||||||
with TestRun.step(
|
with TestRun.step(
|
||||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
for i in range(1, 6):
|
for i in range(1, 6):
|
||||||
fs_utils.create_directory(f"{mountpoint}/dir{i}")
|
create_directory(f"{mountpoint}/dir{i}")
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
with TestRun.step("Perform IO fulfilling each condition and check if occupancy raises."):
|
with TestRun.step("Perform IO fulfilling each condition and check if occupancy raises."):
|
||||||
@ -683,7 +683,7 @@ def test_ioclass_conditions_and():
|
|||||||
TestRun.LOGGER.info(
|
TestRun.LOGGER.info(
|
||||||
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
||||||
)
|
)
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
@ -744,9 +744,9 @@ def test_ioclass_effective_ioclass():
|
|||||||
with TestRun.LOGGER.step(
|
with TestRun.LOGGER.step(
|
||||||
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
||||||
):
|
):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core.create_filesystem(filesystem)
|
||||||
core.mount(mountpoint)
|
core.mount(mountpoint)
|
||||||
fs_utils.create_directory(test_dir)
|
create_directory(test_dir)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
for i, permutation in TestRun.iteration(enumerate(permutations(range(1, 5)), start=1)):
|
for i, permutation in TestRun.iteration(enumerate(permutations(range(1, 5)), start=1)):
|
||||||
@ -832,7 +832,7 @@ def add_done_to_second_non_exclusive_condition(rules, permutation, cache):
|
|||||||
if non_exclusive_conditions == 2:
|
if non_exclusive_conditions == 2:
|
||||||
break
|
break
|
||||||
second_class_id += 1
|
second_class_id += 1
|
||||||
fs_utils.replace_first_pattern_occurrence(ioclass_config_path, rules[idx], f"{rules[idx]}&done")
|
replace_first_pattern_occurrence(ioclass_config_path, rules[idx], f"{rules[idx]}&done")
|
||||||
sync()
|
sync()
|
||||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||||
return second_class_id
|
return second_class_id
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import (
|
from api.cas.cache_config import (
|
||||||
CacheMode,
|
CacheMode,
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, FlushParametersAlru, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, FlushParametersAlru, SeqCutOffPolicy
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import pytest
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import test_tools.common.wait
|
from test_tools.common.wait import wait
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from test_tools import fs_tools
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
|
from test_tools.fs_tools import create_random_test_file
|
||||||
from test_utils.filesystem.file import File
|
from test_utils.filesystem.file import File
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
def create_test_files(test_file_size):
|
def create_test_files(test_file_size):
|
||||||
source_file = fs_utils.create_random_test_file("/tmp/source_test_file", test_file_size)
|
source_file = create_random_test_file("/tmp/source_test_file", test_file_size)
|
||||||
target_file = File.create_file("/tmp/target_test_file")
|
target_file = File.create_file("/tmp/target_test_file")
|
||||||
return source_file, target_file
|
return source_file, target_file
|
||||||
|
|
||||||
@ -47,8 +48,10 @@ def power_cycle_dut(wait_for_flush_begin=False, core_device=None):
|
|||||||
raise Exception("Core device is None.")
|
raise Exception("Core device is None.")
|
||||||
TestRun.LOGGER.info("Waiting for flushing to begin...")
|
TestRun.LOGGER.info("Waiting for flushing to begin...")
|
||||||
core_writes_before = core_device.get_io_stats().sectors_written
|
core_writes_before = core_device.get_io_stats().sectors_written
|
||||||
test_tools.common.wait.wait(lambda: core_writes_before < core_device.get_io_stats().sectors_written,
|
wait(
|
||||||
timedelta(minutes=3),
|
lambda: core_writes_before < core_device.get_io_stats().sectors_written,
|
||||||
timedelta(milliseconds=100))
|
timedelta(minutes=3),
|
||||||
|
timedelta(milliseconds=100)
|
||||||
|
)
|
||||||
power_control = TestRun.plugin_manager.get_plugin('power_control')
|
power_control = TestRun.plugin_manager.get_plugin('power_control')
|
||||||
power_control.power_cycle()
|
power_control.power_cycle()
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize, CleaningPolicy, \
|
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize, CleaningPolicy, \
|
||||||
FlushParametersAcp
|
FlushParametersAcp
|
||||||
@ -58,7 +57,7 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
|
|||||||
file_md5 = test_file.md5sum()
|
file_md5 = test_file.md5sum()
|
||||||
|
|
||||||
with TestRun.step(f"Make {filesystem} on core device."):
|
with TestRun.step(f"Make {filesystem} on core device."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_device.create_filesystem(filesystem)
|
||||||
|
|
||||||
with TestRun.step("Mount core device."):
|
with TestRun.step("Mount core device."):
|
||||||
core_device.mount(mount_point)
|
core_device.mount(mount_point)
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -125,8 +124,8 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
|||||||
cache_device = cache_disk.partitions[0]
|
cache_device = cache_disk.partitions[0]
|
||||||
core_device = core_disk.partitions[0]
|
core_device = core_disk.partitions[0]
|
||||||
|
|
||||||
with TestRun.step(f"Create {fs} filesystem on core."):
|
with TestRun.step(f"Create {fs} filesystem on core device."):
|
||||||
test_tools.fs_utils.create_filesystem(fs)
|
core_device.create_filesystem(fs)
|
||||||
|
|
||||||
with TestRun.step("Create test files."):
|
with TestRun.step("Create test files."):
|
||||||
source_file, target_file = create_test_files(test_file_size)
|
source_file, target_file = create_test_files(test_file_size)
|
||||||
@ -151,7 +150,7 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
|||||||
core.unmount()
|
core.unmount()
|
||||||
|
|
||||||
with TestRun.step("Trigger flush."):
|
with TestRun.step("Trigger flush."):
|
||||||
os_utils.drop_caches(DropCachesMode.ALL)
|
drop_caches(DropCachesMode.ALL)
|
||||||
TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}"))
|
TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}"))
|
||||||
|
|
||||||
with TestRun.step("Hard reset DUT during data flushing."):
|
with TestRun.step("Hard reset DUT during data flushing."):
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, cli_messages
|
from api.cas import casadm, cli_messages
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -54,7 +52,7 @@ def test_recovery_unplug_cache_fs(cache_mode, cls, filesystem, direct):
|
|||||||
source_file_md5 = source_file.md5sum()
|
source_file_md5 = source_file.md5sum()
|
||||||
|
|
||||||
with TestRun.step("Create filesystem on core device."):
|
with TestRun.step("Create filesystem on core device."):
|
||||||
test_tools.fs_utils.create_filesystem(filesystem)
|
core_device.create_filesystem(filesystem)
|
||||||
|
|
||||||
with TestRun.step("Start cache and add core."):
|
with TestRun.step("Start cache and add core."):
|
||||||
cache = casadm.start_cache(cache_device, cache_mode, cls)
|
cache = casadm.start_cache(cache_device, cache_mode, cls)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, casadm_parser
|
from api.cas import casadm, casadm_parser
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2021 Intel Corporation
|
# Copyright(c) 2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, casadm_parser
|
from api.cas import casadm, casadm_parser
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||||
from core.test_run_utils import TestRun
|
from core.test_run_utils import TestRun
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.cli import stop_cmd
|
from api.cas.cli import stop_cmd
|
||||||
@ -56,7 +56,7 @@ def test_flush_over_640_gibibytes_with_fs(cache_mode, fs):
|
|||||||
cache = casadm.start_cache(cache_part, cache_mode)
|
cache = casadm.start_cache(cache_part, cache_mode)
|
||||||
|
|
||||||
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(fs)
|
core_dev.create_filesystem(fs)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
core.mount(mnt_point)
|
core.mount(mnt_point)
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ def test_flush_over_640_gibibytes_with_fs(cache_mode, fs):
|
|||||||
|
|
||||||
with TestRun.step("Create a test file on a separate disk"):
|
with TestRun.step("Create a test file on a separate disk"):
|
||||||
src_dir_path = "/mnt/flush_640G_test"
|
src_dir_path = "/mnt/flush_640G_test"
|
||||||
test_tools.fs_utils.create_filesystem(fs)
|
separate_dev.create_filesystem(fs)
|
||||||
separate_dev.mount(src_dir_path)
|
separate_dev.mount(src_dir_path)
|
||||||
|
|
||||||
test_file_main = File.create_file(f"{src_dir_path}/test_file_main")
|
test_file_main = File.create_file(f"{src_dir_path}/test_file_main")
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait, SeqCutOffPolicy
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
@ -180,7 +180,7 @@ def test_clean_remove_core_with_fs(cache_mode, fs):
|
|||||||
cache = casadm.start_cache(cache_part, cache_mode)
|
cache = casadm.start_cache(cache_part, cache_mode)
|
||||||
|
|
||||||
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(fs)
|
core_part.create_filesystem(fs)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
core.mount(mnt_point)
|
core.mount(mnt_point)
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import (CacheMode,
|
from api.cas.cache_config import (CacheMode,
|
||||||
CacheModeTrait,
|
CacheModeTrait,
|
||||||
@ -47,7 +48,7 @@ def test_flush_signal_core(cache_mode):
|
|||||||
|
|
||||||
with TestRun.step("Start cache and add SCSI device with xfs filesystem as core."):
|
with TestRun.step("Start cache and add SCSI device with xfs filesystem as core."):
|
||||||
cache = casadm.start_cache(cache_part, cache_mode)
|
cache = casadm.start_cache(cache_part, cache_mode)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_dev.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
|
|
||||||
with TestRun.step("Mount exported object."):
|
with TestRun.step("Mount exported object."):
|
||||||
@ -145,7 +146,7 @@ def test_flush_signal_cache(cache_mode):
|
|||||||
|
|
||||||
with TestRun.step("Start SCSI device as cache and add core with xfs filesystem."):
|
with TestRun.step("Start SCSI device as cache and add core with xfs filesystem."):
|
||||||
cache = casadm.start_cache(cache_dev, cache_mode)
|
cache = casadm.start_cache(cache_dev, cache_mode)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_part.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_part)
|
core = cache.add_core(core_part)
|
||||||
|
|
||||||
with TestRun.step("Mount exported object."):
|
with TestRun.step("Mount exported object."):
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.casadm_parser import get_flushing_progress, wait_for_flushing
|
from api.cas.casadm_parser import get_flushing_progress, wait_for_flushing
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -40,8 +42,8 @@ def test_wb_throttling():
|
|||||||
description: |
|
description: |
|
||||||
Fill cache with data, run intensive IO (rwmix=74) with occasional trims.
|
Fill cache with data, run intensive IO (rwmix=74) with occasional trims.
|
||||||
pass_criteria:
|
pass_criteria:
|
||||||
- Hang task did not occurred
|
- Hang task did not occur
|
||||||
- System did not crashed
|
- System did not crash
|
||||||
"""
|
"""
|
||||||
with TestRun.step("Prepare devices."):
|
with TestRun.step("Prepare devices."):
|
||||||
cache_device = TestRun.disks["cache"]
|
cache_device = TestRun.disks["cache"]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import posixpath
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli_messages
|
from api.cas import casadm, cli_messages
|
||||||
@ -13,8 +12,8 @@ from api.cas.cache_config import CacheLineSize
|
|||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
from storage_devices.disk import DiskTypeSet, DiskType
|
from storage_devices.disk import DiskTypeSet, DiskType
|
||||||
from test_tools import disk_tools
|
|
||||||
from connection.utils.output import CmdException
|
from connection.utils.output import CmdException
|
||||||
|
from test_tools.disk_tools import get_block_size, get_size
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
@ -103,8 +102,8 @@ def create_scsi_debug_device(sector_size: int, physblk_exp: int, dev_size_mb=102
|
|||||||
def prepare_cas_device(cache_device, core_device):
|
def prepare_cas_device(cache_device, core_device):
|
||||||
cache = casadm.start_cache(cache_device, cache_line_size=CacheLineSize.LINE_64KiB, force=True)
|
cache = casadm.start_cache(cache_device, cache_line_size=CacheLineSize.LINE_64KiB, force=True)
|
||||||
try:
|
try:
|
||||||
cache_dev_bs = disk_utils.get_block_size(cache_device.device_id)
|
cache_dev_bs = get_block_size(cache_device.device_id)
|
||||||
core_dev_bs = disk_utils.get_block_size(core_device.device_id)
|
core_dev_bs = get_block_size(core_device.device_id)
|
||||||
core = cache.add_core(core_device)
|
core = cache.add_core(core_device)
|
||||||
if cache_dev_bs > core_dev_bs:
|
if cache_dev_bs > core_dev_bs:
|
||||||
TestRun.LOGGER.error(
|
TestRun.LOGGER.error(
|
||||||
@ -154,9 +153,9 @@ def compare_capabilities(cache_device, core_device, cache, core, msg):
|
|||||||
cli_messages.try_add_core_sector_size_mismatch)
|
cli_messages.try_add_core_sector_size_mismatch)
|
||||||
else:
|
else:
|
||||||
core_dev_sectors_num = \
|
core_dev_sectors_num = \
|
||||||
disk_utils.get_size(core_device.device_id) / disk_utils.get_block_size(
|
get_size(core_device.device_id) / get_block_size(
|
||||||
core_device.device_id)
|
core_device.device_id)
|
||||||
core_sectors_num = disk_utils.get_size(core.device_id) / disk_utils.get_block_size(
|
core_sectors_num = get_size(core.device_id) / get_block_size(
|
||||||
core.device_id)
|
core.device_id)
|
||||||
if core_dev_sectors_num != core_sectors_num:
|
if core_dev_sectors_num != core_sectors_num:
|
||||||
TestRun.LOGGER.error(
|
TestRun.LOGGER.error(
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from test_tools.git import get_repo_files
|
from test_tools.git import get_repo_files
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import (
|
from api.cas.cache_config import (
|
||||||
CacheMode,
|
CacheMode,
|
||||||
@ -45,7 +46,7 @@ def test_flush_signal_propagation_cache():
|
|||||||
|
|
||||||
with TestRun.step("Start cache on SCSI device and add core with xfs filesystem"):
|
with TestRun.step("Start cache on SCSI device and add core with xfs filesystem"):
|
||||||
cache = casadm.start_cache(cache_dev, CacheMode.WT)
|
cache = casadm.start_cache(cache_dev, CacheMode.WT)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_dev.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
|
|
||||||
with TestRun.step("Turn off cleaning policy and sequential cutoff"):
|
with TestRun.step("Turn off cleaning policy and sequential cutoff"):
|
||||||
@ -91,7 +92,7 @@ def test_flush_signal_propagation_core():
|
|||||||
|
|
||||||
with TestRun.step("Start cache and add SCSI device with xfs filesystem as core."):
|
with TestRun.step("Start cache and add SCSI device with xfs filesystem as core."):
|
||||||
cache = casadm.start_cache(cache_dev, CacheMode.WT)
|
cache = casadm.start_cache(cache_dev, CacheMode.WT)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_dev.create_filesystem(Filesystem.xfs)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
|
|
||||||
with TestRun.step("Turn off cleaning policy and sequential cutoff"):
|
with TestRun.step("Turn off cleaning policy and sequential cutoff"):
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cas_packaging import Packages
|
||||||
from api.cas.installer import clean_opencas_repo, rsync_opencas_sources
|
from api.cas.installer import clean_opencas_repo, rsync_opencas_sources
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from test_tools.fs_tools import (
|
from test_tools.fs_tools import (
|
||||||
@ -17,7 +17,6 @@ from test_tools.fs_tools import (
|
|||||||
readlink,
|
readlink,
|
||||||
remove,
|
remove,
|
||||||
)
|
)
|
||||||
from api.cas.packaging import Packages
|
|
||||||
|
|
||||||
|
|
||||||
modules_links_dir = "/lib/modules/$(uname -r)/weak-updates/block/opencas"
|
modules_links_dir = "/lib/modules/$(uname -r)/weak-updates/block/opencas"
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.progress_bar import check_progress_bar
|
from api.cas.progress_bar import check_progress_bar
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import pytest
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.progress_bar import check_progress_bar
|
from api.cas.progress_bar import check_progress_bar
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.progress_bar import check_progress_bar
|
from api.cas.progress_bar import check_progress_bar
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.progress_bar import check_progress_bar
|
from api.cas.progress_bar import check_progress_bar
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2022 Intel Corporation
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||||
from api.cas.progress_bar import check_progress_bar
|
from api.cas.progress_bar import check_progress_bar
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
# Copyright(c) 2024 Huawei Technologies
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
|
import yaml
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize, KernelParameters, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CacheLineSize, KernelParameters, CleaningPolicy
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -67,7 +67,7 @@ def prepare_cas_instance(
|
|||||||
cache.set_cleaning_policy(cleaning_policy)
|
cache.set_cleaning_policy(cleaning_policy)
|
||||||
|
|
||||||
if mount_point:
|
if mount_point:
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
core_device.create_filesystem(Filesystem.ext4)
|
||||||
core = cache.add_core(core_device)
|
core = cache.add_core(core_device)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
else:
|
else:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm, cli
|
from api.cas import casadm, cli
|
||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from api.cas.casadm_params import OutputFormat
|
from api.cas.casadm_params import OutputFormat
|
||||||
from api.cas.init_config import InitConfig
|
from api.cas.init_config import InitConfig
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_tools
|
from test_tools.fs_tools import Filesystem, ls_item, parse_ls_output
|
||||||
from test_tools.fs_tools import Filesystem
|
|
||||||
from test_tools.os_tools import create_user, check_if_user_exists
|
from test_tools.os_tools import create_user, check_if_user_exists
|
||||||
from connection.utils.output import CmdException
|
from connection.utils.output import CmdException
|
||||||
from type_def.size import Size, Unit
|
from type_def.size import Size, Unit
|
||||||
@ -52,18 +50,18 @@ def test_user_cli():
|
|||||||
cache = casadm.start_cache(cache_dev, force=True)
|
cache = casadm.start_cache(cache_dev, force=True)
|
||||||
|
|
||||||
with TestRun.step("Add core to cache and mount it."):
|
with TestRun.step("Add core to cache and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core_part1.create_filesystem(Filesystem.ext3)
|
||||||
core = cache.add_core(core_part1)
|
core = cache.add_core(core_part1)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
with TestRun.step(f"Copy casadm bin from {system_casadm_bin_path} "
|
with TestRun.step(f"Copy casadm bin from {system_casadm_bin_path} "
|
||||||
f"to {user_casadm_bin_dest_path}."):
|
f"to {user_casadm_bin_dest_path}."):
|
||||||
casadm_bin = fs_utils.parse_ls_output(fs_utils.ls_item(f"{system_casadm_bin_path}"))[0]
|
casadm_bin = parse_ls_output(ls_item(f"{system_casadm_bin_path}"))[0]
|
||||||
casadm_bin_copy = casadm_bin.copy(user_casadm_bin_dest_path, True)
|
casadm_bin_copy = casadm_bin.copy(user_casadm_bin_dest_path, True)
|
||||||
casadm_bin_copy.chmod_numerical(777)
|
casadm_bin_copy.chmod_numerical(777)
|
||||||
|
|
||||||
with TestRun.step("Copy IO class config."):
|
with TestRun.step("Copy IO class config."):
|
||||||
io_conf = fs_utils.parse_ls_output(fs_utils.ls_item(f"{ioclass_config_path}"))[0]
|
io_conf = parse_ls_output(ls_item(f"{ioclass_config_path}"))[0]
|
||||||
io_conf_copy = io_conf.copy(ioclass_config_copy_path, force=True)
|
io_conf_copy = io_conf.copy(ioclass_config_copy_path, force=True)
|
||||||
|
|
||||||
with TestRun.step("Unmount core."):
|
with TestRun.step("Unmount core."):
|
||||||
@ -404,7 +402,7 @@ def test_user_service():
|
|||||||
cache = casadm.start_cache(cache_dev, force=True)
|
cache = casadm.start_cache(cache_dev, force=True)
|
||||||
|
|
||||||
with TestRun.step("Add core to cache and mount it."):
|
with TestRun.step("Add core to cache and mount it."):
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
core_dev.create_filesystem(Filesystem.ext3)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
core.mount(mount_point)
|
core.mount(mount_point)
|
||||||
|
|
||||||
@ -413,7 +411,7 @@ def test_user_service():
|
|||||||
|
|
||||||
with TestRun.step(f"Copy casadm bin from {system_casadm_bin_path} "
|
with TestRun.step(f"Copy casadm bin from {system_casadm_bin_path} "
|
||||||
f"to {user_casadm_bin_dest_path}."):
|
f"to {user_casadm_bin_dest_path}."):
|
||||||
casadm_bin = fs_utils.parse_ls_output(fs_utils.ls_item(f"{system_casadm_bin_path}"))[0]
|
casadm_bin = parse_ls_output(ls_item(f"{system_casadm_bin_path}"))[0]
|
||||||
casadm_bin_copy = casadm_bin.copy(user_casadm_bin_dest_path, True)
|
casadm_bin_copy = casadm_bin.copy(user_casadm_bin_dest_path, True)
|
||||||
casadm_bin_copy.chmod_numerical(777)
|
casadm_bin_copy.chmod_numerical(777)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -7,7 +8,6 @@ import random
|
|||||||
import re
|
import re
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize, CacheModeTrait
|
from api.cas.cache_config import CacheMode, CacheLineSize, CacheModeTrait
|
||||||
from api.cas.casadm import OutputFormat, print_statistics, start_cache
|
from api.cas.casadm import OutputFormat, print_statistics, start_cache
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -46,7 +46,7 @@ def test_output_consistency(cache_line_size, cache_mode, test_object):
|
|||||||
|
|
||||||
with TestRun.step("Start cache and add core with a filesystem."):
|
with TestRun.step("Start cache and add core with a filesystem."):
|
||||||
cache = start_cache(cache_part, cache_mode, cache_line_size, force=True)
|
cache = start_cache(cache_part, cache_mode, cache_line_size, force=True)
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
core_part.create_filesystem(Filesystem.xfs)
|
||||||
exp_obj = cache.add_core(core_part)
|
exp_obj = cache.add_core(core_part)
|
||||||
|
|
||||||
with TestRun.step("Select object to test."):
|
with TestRun.step("Select object to test."):
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
import time
|
import time
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import (
|
from api.cas.cache_config import (
|
||||||
CacheLineSize,
|
CacheLineSize,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
import random
|
|
||||||
|
|
||||||
|
import random
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import test_tools.fs_tools
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas import ioclass_config
|
from api.cas import ioclass_config
|
||||||
from api.cas.cache_config import CleaningPolicy, CacheMode, CacheLineSize
|
from api.cas.cache_config import CleaningPolicy, CacheMode, CacheLineSize
|
||||||
@ -311,7 +311,7 @@ def prepare(random_cls, cache_count=1, cores_per_cache=1):
|
|||||||
cache_devices = cache_device.partitions
|
cache_devices = cache_device.partitions
|
||||||
core_devices = core_device.partitions
|
core_devices = core_device.partitions
|
||||||
for core_device in core_devices:
|
for core_device in core_devices:
|
||||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
core_device.create_filesystem(Filesystem.ext4)
|
||||||
|
|
||||||
Udev.disable()
|
Udev.disable()
|
||||||
caches, cores = [], []
|
caches, cores = [], []
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||||
from api.cas.casadm import StatsFilter
|
from api.cas.casadm import StatsFilter
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheModeTrait
|
from api.cas.cache_config import CacheMode, CacheModeTrait
|
||||||
from api.cas.casadm import StatsFilter
|
from api.cas.casadm import StatsFilter
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user