Disk tools and fs tools refactor
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
@@ -12,7 +12,7 @@ from api.cas.casadm_params import OutputFormat
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools import fs_tools
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
ioclass_config_path = "/tmp/opencas_ioclass.conf"
|
||||
|
@@ -9,12 +9,13 @@ from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools import fs_tools
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_utils.filesystem.directory import Directory
|
||||
from test_utils.filesystem.file import File
|
||||
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
||||
@@ -46,7 +47,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -178,7 +179,7 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(fs_type=filesystem)
|
||||
test_tools.fs_utils.create_filesystem(fs_type=filesystem)
|
||||
core.mount(mount_point=mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -346,7 +347,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(fs_type=filesystem)
|
||||
test_tools.fs_utils.create_filesystem(fs_type=filesystem)
|
||||
core.mount(mount_point=mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -8,9 +8,10 @@ from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from .io_class_common import *
|
||||
|
||||
|
||||
@@ -37,7 +38,7 @@ def test_io_class_eviction_priority():
|
||||
|
||||
with TestRun.step(f"Preparing filesystem and mounting {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -7,11 +7,12 @@ import random
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_utils.filesystem.file import File
|
||||
from test_tools.os_tools import sync, DropCachesMode, drop_caches
|
||||
from type_def.size import Size, Unit
|
||||
@@ -56,7 +57,7 @@ def test_ioclass_file_extension():
|
||||
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}."):
|
||||
core.create_filesystem(Filesystem.ext3)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
||||
core.mount(mountpoint)
|
||||
|
||||
with TestRun.step("Flush cache."):
|
||||
@@ -123,7 +124,7 @@ def test_ioclass_file_name_prefix():
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
previous_occupancy = cache.get_occupancy()
|
||||
|
||||
core.create_filesystem(Filesystem.ext3)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
||||
core.mount(mountpoint)
|
||||
|
||||
current_occupancy = cache.get_occupancy()
|
||||
@@ -209,7 +210,7 @@ def test_ioclass_file_extension_preexisting_filesystem():
|
||||
|
||||
with TestRun.step(f"Prepare files on raw block device."):
|
||||
casadm.remove_core(cache.cache_id, core_id=core.core_id)
|
||||
core.core_device.create_filesystem(Filesystem.ext3)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
||||
core.core_device.mount(mountpoint)
|
||||
|
||||
for ext in extensions:
|
||||
@@ -291,7 +292,7 @@ def test_ioclass_file_offset():
|
||||
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}."):
|
||||
core.create_filesystem(Filesystem.ext3)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext3)
|
||||
core.mount(mountpoint)
|
||||
|
||||
with TestRun.step("Flush cache."):
|
||||
@@ -383,7 +384,7 @@ def test_ioclass_file_size(filesystem):
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -6,14 +6,15 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm, ioclass_config
|
||||
from api.cas.cache_config import CacheMode
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from storage_devices.lvm import Lvm, LvmConfiguration
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||
from type_def.size import Size, Unit
|
||||
@@ -58,7 +59,7 @@ def test_io_class_lvm_on_cas():
|
||||
lvm = lvms[0]
|
||||
|
||||
with TestRun.step("Create filesystem for LVM and mount it."):
|
||||
lvm.create_filesystem(Filesystem.ext4)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
||||
lvm.mount(mount_point)
|
||||
|
||||
with TestRun.step("Prepare and load IO class config."):
|
||||
|
@@ -9,13 +9,14 @@ from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.os_tools import sync
|
||||
from test_tools.udev import Udev
|
||||
from type_def.size import Unit, Size
|
||||
@@ -56,7 +57,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}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -186,7 +187,7 @@ def test_io_class_occupancy_directory_read(io_size_multiplication):
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -316,7 +317,7 @@ def test_ioclass_occupancy_sum_cache():
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -8,13 +8,14 @@ from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||
from storage_devices.device import Device
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.os_tools import sync
|
||||
from test_tools.udev import Udev
|
||||
from tests.io_class.io_class_common import (
|
||||
@@ -53,7 +54,7 @@ def test_ioclass_occupancy_load():
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -8,13 +8,14 @@ from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||
from core.test_run_utils import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.os_tools import sync
|
||||
from test_tools.udev import Udev
|
||||
from type_def.size import Unit
|
||||
@@ -55,7 +56,7 @@ def test_ioclass_repart(io_class_size_multiplication):
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -6,13 +6,14 @@
|
||||
import pytest
|
||||
from recordclass import recordclass
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.os_tools import sync
|
||||
from test_tools.udev import Udev
|
||||
from type_def.size import Unit
|
||||
@@ -47,7 +48,7 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -7,11 +7,11 @@ import pytest
|
||||
from collections import namedtuple
|
||||
from math import isclose
|
||||
|
||||
|
||||
import test_tools.fs_tools
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from api.cas.ioclass_config import IoClass, default_config_file_path
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from core.test_run import TestRun
|
||||
from type_def.size import Size, Unit
|
||||
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
|
||||
|
||||
with TestRun.step("Mount filesystem"):
|
||||
core.create_filesystem(Filesystem.xfs)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core.mount(mountpoint)
|
||||
|
||||
with TestRun.step("Prepare test dirs"):
|
||||
@@ -141,7 +141,7 @@ def test_pinned_ioclasses_eviction():
|
||||
cache_line_count = cache.get_statistics().config_stats.cache_size
|
||||
|
||||
with TestRun.step("Mount filesystem"):
|
||||
core.create_filesystem(Filesystem.xfs)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core.mount(mountpoint)
|
||||
|
||||
with TestRun.step("Prepare test dirs"):
|
||||
|
@@ -9,7 +9,7 @@ from api.cas import ioclass_config, cli_messages
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools import fs_tools
|
||||
from connection.utils.output import CmdException
|
||||
from type_def.size import Unit, Size
|
||||
from tests.io_class.io_class_common import prepare, ioclass_config_path
|
||||
|
@@ -8,12 +8,13 @@ from collections import namedtuple
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools import fs_tools
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.os_tools import drop_caches, DropCachesMode, sync
|
||||
from test_tools.udev import Udev
|
||||
from type_def.size import Unit, Size
|
||||
@@ -42,7 +43,7 @@ def test_ioclass_usage_sum():
|
||||
|
||||
with TestRun.step(f"Prepare filesystem and mount {core.path} at {mountpoint}"):
|
||||
filesystem = Filesystem.xfs
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import os
|
||||
import pytest
|
||||
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
|
||||
@@ -15,8 +16,8 @@ from api.cas.init_config import InitConfig
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run_utils import TestRun
|
||||
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
||||
from test_tools.os_tools import sync, drop_caches
|
||||
@@ -51,7 +52,7 @@ def test_io_class_service_load(runlevel):
|
||||
run_io_dir_read(core.path)
|
||||
|
||||
with TestRun.step("Create ext4 filesystem on CAS device and mount it."):
|
||||
core.create_filesystem(Filesystem.ext4)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.ext4)
|
||||
core.mount(mountpoint)
|
||||
|
||||
with TestRun.step(
|
||||
|
@@ -13,8 +13,8 @@ from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run_utils import TestRun
|
||||
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import IoEngine, ReadWrite
|
||||
from test_tools.os_tools import sync, drop_caches
|
||||
|
@@ -9,13 +9,14 @@ from itertools import permutations
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import ioclass_config, casadm
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools import fs_tools
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fio.fio import Fio
|
||||
from test_tools.fio.fio_param import ReadWrite, IoEngine
|
||||
from test_utils.filesystem.file import File
|
||||
@@ -232,7 +233,7 @@ def test_ioclass_direct(filesystem):
|
||||
f"Preparing {filesystem.name} filesystem and mounting {core.path} at"
|
||||
f" {mountpoint}"
|
||||
)
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
else:
|
||||
@@ -328,7 +329,7 @@ def test_ioclass_metadata(filesystem):
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem and mount {core.path} " f"at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -474,7 +475,7 @@ def test_ioclass_id_as_condition():
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
fs_utils.create_directory(base_dir_path)
|
||||
sync()
|
||||
@@ -615,7 +616,7 @@ def test_ioclass_conditions_or():
|
||||
with TestRun.step(
|
||||
f"Prepare {filesystem.name} filesystem " f"and mount {core.path} at {mountpoint}."
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
for i in range(1, 6):
|
||||
fs_utils.create_directory(f"{mountpoint}/dir{i}")
|
||||
@@ -682,7 +683,7 @@ def test_ioclass_conditions_and():
|
||||
TestRun.LOGGER.info(
|
||||
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
||||
)
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
@@ -743,7 +744,7 @@ def test_ioclass_effective_ioclass():
|
||||
with TestRun.LOGGER.step(
|
||||
f"Preparing {filesystem.name} filesystem " f"and mounting {core.path} at {mountpoint}"
|
||||
):
|
||||
core.create_filesystem(filesystem)
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core.mount(mountpoint)
|
||||
fs_utils.create_directory(test_dir)
|
||||
sync()
|
||||
|
Reference in New Issue
Block a user