Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/tests/ftest/dfuse/fio_pil4dfs_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import os

from dfuse_utils import get_dfuse, start_dfuse
from fio_test_base import FioBase
from fio_utils import TestFio


class FioPil4dfsSmall(FioBase):
class FioPil4dfsSmall(TestFio):
"""Test class Description: Runs Fio with in small config.

:avocado: recursive
Expand All @@ -28,7 +28,8 @@ def test_fio_pil4dfs_small(self):
:avocado: tags=dfuse,fio,checksum,tx,pil4dfs
:avocado: tags=FioPil4dfsSmall,test_fio_pil4dfs_small
"""
self.fio_cmd.env['LD_PRELOAD'] = os.path.join(self.prefix, 'lib64', 'libpil4dfs.so')
fio_cmd = self.get_fio_command()
fio_cmd.env['LD_PRELOAD'] = os.path.join(self.prefix, 'lib64', 'libpil4dfs.so')

self.log_step('Create a pool')
pool = self.get_pool(connect=False)
Expand All @@ -42,18 +43,18 @@ def test_fio_pil4dfs_small(self):
self.log_step('Start dfuse')
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)
self.fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd.update_directory(dfuse.mount_dir.value)

# Run with various fio parameters
for variant in self.params.get("variants", '/run/fio/global/*'):
self.log_step(
f'Run fio with direct={variant[0]}, blocksize={variant[1]}, '
f'size={variant[2]}, rw={variant[3]}')
self.fio_cmd.update('global', 'direct', variant[0], 'global.direct')
self.fio_cmd.update('global', 'blocksize', variant[1], 'global.blocksize')
self.fio_cmd.update('global', 'size', variant[2], 'global.size')
self.fio_cmd.update('global', 'rw', variant[3], 'global.rw')
self.execute_fio()
fio_cmd.update('global', 'direct', variant[0], 'global.direct')
fio_cmd.update('global', 'blocksize', variant[1], 'global.blocksize')
fio_cmd.update('global', 'size', variant[2], 'global.size')
fio_cmd.update('global', 'rw', variant[3], 'global.rw')
fio_cmd.run()

self.log_step('Stop dfuse and destroy container')
dfuse.stop()
Expand Down
17 changes: 9 additions & 8 deletions src/tests/ftest/dfuse/fio_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"""

from dfuse_utils import get_dfuse, start_dfuse
from fio_test_base import FioBase
from fio_utils import TestFio


class FioSmall(FioBase):
class FioSmall(TestFio):
"""Test class Description: Runs Fio with in small config.

:avocado: recursive
Expand Down Expand Up @@ -38,18 +38,19 @@ def test_fio_small(self):
self.log_step('Start dfuse')
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)
self.fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd = self.get_fio_command()
fio_cmd.update_directory(dfuse.mount_dir.value)

# Run with various fio parameters
for variant in self.params.get("variants", '/run/fio/global/*'):
self.log_step(
f'Run fio with direct={variant[0]}, blocksize={variant[1]}, '
f'size={variant[2]}, rw={variant[3]}')
self.fio_cmd.update('global', 'direct', variant[0], 'global.direct')
self.fio_cmd.update('global', 'blocksize', variant[1], 'global.blocksize')
self.fio_cmd.update('global', 'size', variant[2], 'global.size')
self.fio_cmd.update('global', 'rw', variant[3], 'global.rw')
self.execute_fio()
fio_cmd.update('global', 'direct', variant[0], 'global.direct')
fio_cmd.update('global', 'blocksize', variant[1], 'global.blocksize')
fio_cmd.update('global', 'size', variant[2], 'global.size')
fio_cmd.update('global', 'rw', variant[3], 'global.rw')
fio_cmd.run()

self.log_step('Stop dfuse and destroy container')
dfuse.stop()
Expand Down
14 changes: 5 additions & 9 deletions src/tests/ftest/dfuse/pil4dfs_fio.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""
(C) Copyright 2019-2024 Intel Corporation.
(C) Copyright 2026 Hewlett Packard Enterprise Development LP

SPDX-License-Identifier: BSD-2-Clause-Patent
"""

import json
import os

from apricot import TestWithServers
from ClusterShell.NodeSet import NodeSet
from cpu_utils import CpuInfo
from dfuse_utils import get_dfuse, start_dfuse
from fio_utils import FioCommand
from fio_utils import TestFio
from general_utils import bytes_to_human, get_log_file, percent_change


class Pil4dfsFio(TestWithServers):
class Pil4dfsFio(TestFio):
"""Test class Description: Runs Fio with in small config.

:avocado: recursive
Expand Down Expand Up @@ -104,8 +104,7 @@ def _run_fio_pil4dfs(self, ioengine):
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, container.pool, container)

fio_cmd = FioCommand()
fio_cmd.get_params(self)
fio_cmd = self.get_fio_command()
fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd.update("global", "ioengine", ioengine, f"fio --name=global --ioengine='{ioengine}'")
fio_cmd.update(
Expand All @@ -118,7 +117,6 @@ def _run_fio_pil4dfs(self, ioengine):
fio_cmd.env['D_DYNAMIC_CTX'] = 1
fio_cmd.env["D_LOG_FILE"] = get_log_file(self.client_log)
fio_cmd.env["D_LOG_MASK"] = 'INFO'
fio_cmd.hosts = self.hostlist_clients

bws = {}
for rw in Pil4dfsFio._FIO_RW_NAMES:
Expand All @@ -145,8 +143,7 @@ def _run_fio_dfs(self):
"""
container = self._create_container()

fio_cmd = FioCommand()
fio_cmd.get_params(self)
fio_cmd = self.get_fio_command()
fio_cmd.update("global", "ioengine", "dfs", "fio --name=global --ioengine='dfs'")
fio_cmd.update(
"job", "numjobs", self.fio_numjobs, f"fio --name=job --numjobs={self.fio_numjobs}")
Expand All @@ -160,7 +157,6 @@ def _run_fio_dfs(self):
fio_cmd.env['D_DYNAMIC_CTX'] = 1
fio_cmd.env["D_LOG_FILE"] = get_log_file(self.client_log)
fio_cmd.env["D_LOG_MASK"] = 'INFO'
fio_cmd.hosts = self.hostlist_clients

bws = {}
for rw in Pil4dfsFio._FIO_RW_NAMES:
Expand Down
41 changes: 23 additions & 18 deletions src/tests/ftest/erasurecode/rebuild_fio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@
import time

from dfuse_utils import get_dfuse, start_dfuse
from fio_test_base import FioBase
from fio_utils import TestFio


class EcodFioRebuild(FioBase):
class EcodFioRebuild(TestFio):
"""Test class Description: Runs Fio with EC object type over POSIX and
verify on-line, off-line for rebuild and verify the data.

:avocado: recursive
"""

def execution(self, rebuild_mode):
def execution(self, fio_cmd, rebuild_mode):
"""Execute test.

Args:
fio_cmd (FioCommand): Fio command object
rebuild_mode (str): On-line or off-line rebuild mode
"""
aggregation_timeout = self.params.get("aggregation_timeout", "/run/pool/*")
Expand All @@ -42,15 +43,15 @@ def execution(self, rebuild_mode):
container.set_attr(attrs={'dfuse-direct-io-disable': 'on'})
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)
self.fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd.update_directory(dfuse.mount_dir.value)

# Write the Fio data and kill the last server rank if rebuild_mode is on-line
if 'on-line' in rebuild_mode:
self.log_step(f"Start fio and stop the last server rank ({rank_to_kill})")
self.start_online_fio(dfuse.mount_dir.value, rank_to_kill)
self.start_online_fio(fio_cmd, dfuse.mount_dir.value, rank_to_kill)
else:
self.log_step("Start fio and leave all servers running")
self.start_online_fio(dfuse.mount_dir.value, None)
self.start_online_fio(fio_cmd, dfuse.mount_dir.value, None)

# Get initial total free space (scm+nvme)
self.log_step("Get initial total free space (scm+nvme)")
Expand Down Expand Up @@ -87,36 +88,37 @@ def execution(self, rebuild_mode):
# Adding unlink option for final read command
self.log_step("Adding unlink option for final read command")
if int(container.properties.value.split(":")[1]) == 1:
self.fio_cmd._jobs['test'].unlink.value = 1 # pylint: disable=protected-access
fio_cmd._jobs['test'].unlink.value = 1 # pylint: disable=protected-access

# Read and verify the original data.
self.log_step("Read and verify the original data.")
self.fio_cmd._jobs['test'].rw.value = read_option # pylint: disable=protected-access
self.fio_cmd.run()
fio_cmd._jobs['test'].rw.value = read_option # pylint: disable=protected-access
fio_cmd.run()

# If RF is 2 kill one more server and validate the data is not corrupted.
if int(container.properties.value.split(":")[1]) == 2:
# Kill one more server rank
rank_to_kill = num_ranks - 2
self.log_step(f"Kill one more server rank {rank_to_kill} when RF=2")
self.fio_cmd._jobs['test'].unlink.value = 1 # pylint: disable=protected-access
fio_cmd._jobs['test'].unlink.value = 1 # pylint: disable=protected-access
self.server_managers[0].stop_ranks([rank_to_kill], force=True)

# Read and verify the original data.
self.log_step(f"Verify the data is not corrupted after stopping rank {rank_to_kill}.")
self.fio_cmd.run()
fio_cmd.run()

# Pre-teardown: make sure rebuild is done before too-quickly trying to destroy container.
pool.wait_for_rebuild_to_end()

self.log.info("Test passed")

def start_online_fio(self, directory, rank_to_kill=None):
def start_online_fio(self, fio_cmd, directory, rank_to_kill=None):
"""Run Fio operation with thread in background.

Trigger the server failure while Fio is running

Args:
fio_cmd (FioCommand): Fio command object
directory (str): directory to use with the fio command
rank_to_kill (int, optional): the server rank to kill while IO operation is in progress.
Set to None to leave all servers running during IO. Defaults to None.
Expand All @@ -126,7 +128,7 @@ def start_online_fio(self, directory, rank_to_kill=None):
# Create the Fio run thread
job = threading.Thread(
target=self.write_single_fio_dataset,
kwargs={"directory": directory, "results": results_queue})
kwargs={"fio_cmd": fio_cmd, "directory": directory, "results": results_queue})

# Launch the Fio thread
job.start()
Expand All @@ -144,16 +146,17 @@ def start_online_fio(self, directory, rank_to_kill=None):
if results_queue.get() == "FAIL":
self.fail("Error running fio as a thread")

def write_single_fio_dataset(self, directory, results):
def write_single_fio_dataset(self, fio_cmd, directory, results):
"""Run Fio Benchmark.

Args:
fio_cmd (FioCommand): Fio command object
directory (str): directory to use with the fio command
results (queue): queue for returning thread results
"""
try:
self.fio_cmd.update_directory(directory)
self.execute_fio()
fio_cmd.update_directory(directory)
fio_cmd.run()
results.put("PASS")
except Exception: # pylint: disable=broad-except
results.put("FAIL")
Expand Down Expand Up @@ -183,7 +186,8 @@ def test_ec_online_rebuild_fio(self):
:avocado: tags=ec,ec_array,fio,ec_online_rebuild
:avocado: tags=EcodFioRebuild,test_ec_online_rebuild_fio
"""
self.execution('on-line')
fio_cmd = self.get_fio_command()
self.execution(fio_cmd, 'on-line')

def test_ec_offline_rebuild_fio(self):
"""Jira ID: DAOS-7320.
Expand All @@ -203,4 +207,5 @@ def test_ec_offline_rebuild_fio(self):
:avocado: tags=ec,ec_array,fio,ec_offline_rebuild
:avocado: tags=EcodFioRebuild,test_ec_offline_rebuild_fio
"""
self.execution('off-line')
fio_cmd = self.get_fio_command()
self.execution(fio_cmd, 'off-line')
21 changes: 11 additions & 10 deletions src/tests/ftest/erasurecode/truncate.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'''
(C) Copyright 2019-2024 Intel Corporation.
(C) Copyright 2025 Hewlett Packard Enterprise Development LP
(C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP

SPDX-License-Identifier: BSD-2-Clause-Patent
'''
import os

from dfuse_utils import get_dfuse, start_dfuse
from fio_test_base import FioBase
from fio_utils import TestFio
from general_utils import get_remote_file_size
from run_utils import run_remote


class Ecodtruncate(FioBase):
class Ecodtruncate(TestFio):
# pylint: disable=protected-access
"""Test class Description: Runs Fio with EC object type over POSIX and
verify truncate file does not corrupt the data.
Expand Down Expand Up @@ -48,16 +48,17 @@ def test_ec_truncate(self):
container.set_attr(attrs={'dfuse-direct-io-disable': 'on'})
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)
self.fio_cmd.update_directory(dfuse.mount_dir.value)
self.execute_fio()
fio_cmd = self.get_fio_command()
fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd.run()

# Get the fuse file name.
testfile = "{}.0.0".format(os.path.join(dfuse.mount_dir.value, fname[0]))
original_fs = int(self.fio_cmd._jobs['test'].size.value)
original_fs = int(fio_cmd._jobs['test'].size.value)

# Read and verify the original data.
self.fio_cmd._jobs['test'].rw = 'read'
self.fio_cmd.run()
fio_cmd._jobs['test'].rw = 'read'
fio_cmd.run()

# Get the file stats and confirm size
file_size = get_remote_file_size(self.hostlist_clients[0], testfile)
Expand All @@ -75,7 +76,7 @@ def test_ec_truncate(self):
self.assertEqual(truncate_size, file_size)

# Read and verify the data after truncate.
self.fio_cmd.run()
fio_cmd.run()

# Truncate the original file and shrink to original size.
result = run_remote(
Expand All @@ -89,4 +90,4 @@ def test_ec_truncate(self):
original_fs, file_size, "file size after truncase is not equal to original")

# Read and verify the data after truncate.
self.fio_cmd.run()
fio_cmd.run()
9 changes: 5 additions & 4 deletions src/tests/ftest/fault_injection/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
'''
from dfuse_utils import get_dfuse, start_dfuse
from fio_test_base import FioBase
from fio_utils import TestFio
from ior_test_base import IorTestBase


class EcodFaultInjection(IorTestBase, FioBase):
class EcodFaultInjection(IorTestBase, TestFio):
"""EC Fault domains Test class.

Test Class Description: To validate Erasure code object type classes with Fault injection.
Expand Down Expand Up @@ -57,5 +57,6 @@ def test_ec_fio_fault(self):
container.set_attr(attrs={'dfuse-direct-io-disable': 'on'})
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)
self.fio_cmd.update_directory(dfuse.mount_dir.value)
self.execute_fio()
fio_cmd = self.get_fio_command()
fio_cmd.update_directory(dfuse.mount_dir.value)
fio_cmd.run()
Loading
Loading