Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-15643 test: Enable dfuse register cleanup model #14215

Merged
merged 27 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8d680c5
DAOS-15643 test: Enable dfuse register cleanup model
phender Apr 22, 2024
57a430a
Merge branch 'master' into pahender/DAOS-15643
phender Apr 24, 2024
e84c963
Merge branch 'master' into pahender/DAOS-15643
phender Apr 25, 2024
85c9925
Additional file changes.
phender Apr 25, 2024
06652cf
Merge branch 'master' into pahender/DAOS-15643
phender Apr 25, 2024
7176e50
Moving changhes for DAOS-15616 into its own PR.
phender Apr 26, 2024
9761177
Revert copyright updates for unchanged files.
phender Apr 26, 2024
0cf2ecd
Merge branch 'master' into pahender/DAOS-15643
phender Apr 30, 2024
ecb1d9d
Merge with blocking changes.
phender Apr 30, 2024
cfae3fd
Merge branch 'master' into pahender/DAOS-15643
phender Apr 30, 2024
7a31d3d
Merge branch 'master' into pahender/DAOS-15643
phender May 1, 2024
b2b40f5
Test fixes.
phender May 1, 2024
7cb3d4a
Fix erasurecode/rebuild_fio.py
phender May 1, 2024
ee96567
EcodFioRebuild cleanup.
phender May 1, 2024
298a360
Merge branch 'master' into pahender/DAOS-15643
phender May 1, 2024
344d1e2
Merge branch 'master' into pahender/DAOS-15643
phender May 2, 2024
77a6ea2
Fix failing tests.
phender May 2, 2024
1297b46
Applying feedback.
phender May 2, 2024
3ca23d8
Merge branch 'master' into pahender/DAOS-15643
phender May 2, 2024
70bac35
Fix class rename in previous merge.
phender May 2, 2024
beabd59
Merge branch 'master' into pahender/DAOS-15643
phender May 3, 2024
5806cc8
Fix test failures.
phender May 3, 2024
239aa88
Merge branch 'master' into pahender/DAOS-15643
phender May 6, 2024
201ac08
Reinstating the run_ior_with_pool(stop_dfuse=True) argument.
phender May 6, 2024
edf2078
Remove uneccessary changes.
phender May 6, 2024
d5dfc6d
Cleanup changes.
phender May 6, 2024
fa1bd6f
Fix run_ior_with_pool dfuse stop.
phender May 6, 2024
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: 12 additions & 7 deletions src/tests/ftest/aggregation/dfuse_space_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import time

from dfuse_utils import get_dfuse, start_dfuse
from ior_test_base import IorTestBase


Expand Down Expand Up @@ -57,16 +58,19 @@ def wait_for_aggregation(self, retries=4, interval=60):
self.log.info("Free space when test terminated: %s", current_space)
self.fail("Aggregation did not complete within {} seconds".format(retries * interval))

def write_multiple_files(self):
def write_multiple_files(self, dfuse):
"""Write multiple files.

Args:
dfuse (Dfuse): the dfuse object

Returns:
int: Total number of files created before going out of space.

"""
file_count = 0
while self.get_nvme_free_space(False) >= self.block_size:
file_path = os.path.join(self.dfuse.mount_dir.value, "file{}.txt".format(file_count))
file_path = os.path.join(dfuse.mount_dir.value, "file{}.txt".format(file_count))
write_dd_cmd = "dd if=/dev/zero of={} bs={} count=1".format(file_path, self.block_size)
if 0 in self.execute_cmd(write_dd_cmd, fail_on_err=True, display_output=False):
file_count += 1
Expand Down Expand Up @@ -106,13 +110,14 @@ def test_dfusespacecheck(self):
# Create a pool, container, and start dfuse
self.create_pool()
self.create_cont()
self.start_dfuse(self.hostlist_clients, self.pool, self.container)
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, self.pool, self.container)
Comment on lines +113 to +114
Copy link
Contributor

@ashleypittman ashleypittman May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to ask such a high level question when you're so close to getting this working but why is start_dfuse a function, not a method on the DFuse class?

Suggested change
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, self.pool, self.container)
dfuse = get_dfuse(self, self.hostlist_clients)
dfuse.start(self.pool, self.container)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO start_dfuse is a stepping stone between where we are and where we want to be. That function already exists before this PR. We could look at changing behavior to dfuse.start but it would require a little more refactoring that I think could be handled later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but if we're making a interface change that affects the entire suite isn't it better to make that change once rather than planning a second wholesale change as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. It depends on how complicated it is now vs later. I'm talking with @phender about this now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I obviously don't know the details but overall one change is better than two. I am really glad to see this kind of work progressing though.


# get nvme space before write
self.initial_space = self.get_nvme_free_space()

# Create a file as large as we can
large_file = os.path.join(self.dfuse.mount_dir.value, 'largefile.txt')
large_file = os.path.join(dfuse.mount_dir.value, 'largefile.txt')
self.execute_cmd('touch {}'.format(large_file))
dd_count = (self.initial_space // self.block_size) + 1
write_dd_cmd = "dd if=/dev/zero of={} bs={} count={}".format(
Expand All @@ -130,14 +135,14 @@ def test_dfusespacecheck(self):
self.pool.set_property("reclaim", "disabled")

# Write small files until we run out of space
file_count1 = self.write_multiple_files()
file_count1 = self.write_multiple_files(dfuse)

# Enable aggregation
self.log.info("Enabling aggregation")
self.pool.set_property("reclaim", "time")

# remove all the small files created above.
self.execute_cmd("rm -rf {}".format(os.path.join(self.dfuse.mount_dir.value, '*')))
self.execute_cmd("rm -rf {}".format(os.path.join(dfuse.mount_dir.value, '*')))

# Wait for aggregation to complete after file removal
self.wait_for_aggregation()
Expand All @@ -147,7 +152,7 @@ def test_dfusespacecheck(self):
self.pool.set_property("reclaim", "disabled")

# Write small files again until we run out of space and verify we wrote the same amount
file_count2 = self.write_multiple_files()
file_count2 = self.write_multiple_files(dfuse)

self.log.info('file_count1 = %s', file_count1)
self.log.info('file_count2 = %s', file_count2)
Expand Down
26 changes: 14 additions & 12 deletions src/tests/ftest/daos_test/dfuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import os
from collections import OrderedDict

from apricot import TestWithServers
from cmocka_utils import CmockaUtils
from dfuse_test_base import DfuseTestBase
from dfuse_utils import get_dfuse, start_dfuse
from general_utils import create_directory, get_log_file
from job_manager_utils import get_job_manager


class DaosCoreTestDfuse(DfuseTestBase):
class DaosCoreTestDfuse(TestWithServers):
"""Runs DAOS DFuse tests.

:avocado: recursive
Expand All @@ -29,11 +30,11 @@ def run_test(self, il_lib=None):
if il_lib is None:
self.fail('il_lib is not defined.')

self.daos_test = os.path.join(self.bin, 'dfuse_test')
daos_test = os.path.join(self.bin, 'dfuse_test')

# Create a pool, container and start dfuse.
self.add_pool(connect=False)
self.add_container(self.pool)
pool = self.get_pool(connect=False)
container = self.get_container(pool)

cont_attrs = OrderedDict()

Expand Down Expand Up @@ -67,14 +68,15 @@ def run_test(self, il_lib=None):
elif cache_mode == 'native':
use_dfuse = False
else:
self.fail('Invalid cache_mode: {}'.format(cache_mode))
self.fail(f'Invalid cache_mode: {cache_mode}')

if use_dfuse:
self.container.set_attr(attrs=cont_attrs)
container.set_attr(attrs=cont_attrs)

self.start_dfuse(self.hostlist_clients, self.pool, self.container)
dfuse = get_dfuse(self, self.hostlist_clients)
start_dfuse(self, dfuse, pool, container)

mount_dir = self.dfuse.mount_dir.value
mount_dir = dfuse.mount_dir.value
else:
# Bypass, simply create a remote directory and use that.
mount_dir = '/tmp/dfuse-test'
Expand All @@ -94,14 +96,14 @@ def run_test(self, il_lib=None):

if il_lib == 'libpil4dfs.so':
daos_test_env['D_IL_MOUNT_POINT'] = mount_dir
daos_test_env['D_IL_POOL'] = self.pool.identifier
daos_test_env['D_IL_CONTAINER'] = self.container.identifier
daos_test_env['D_IL_POOL'] = pool.identifier
daos_test_env['D_IL_CONTAINER'] = container.identifier
daos_test_env['D_IL_REPORT'] = '0'
daos_test_env['D_IL_MAX_EQ'] = '2'
daos_test_env['D_IL_ENFORCE_EXEC_ENV'] = '1'

command = [
self.daos_test,
daos_test,
'--test-dir',
mount_dir,
'--io',
Expand Down
11 changes: 7 additions & 4 deletions src/tests/ftest/datamover/negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os.path import join

from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse
from duns_utils import format_path


Expand Down Expand Up @@ -60,7 +61,8 @@ def test_dm_bad_params_dcp(self):
self.set_tool("DCP")

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create a test pool
pool1 = self.create_pool()
Expand All @@ -69,7 +71,7 @@ def test_dm_bad_params_dcp(self):
uns_cont = self.get_container(pool1)

# Create a test container
cont1_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
cont1_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
cont1 = self.get_container(pool1, path=cont1_path)

# Create test files
Expand Down Expand Up @@ -209,7 +211,8 @@ def test_dm_bad_params_fs_copy(self):
self.set_tool("FS_COPY")

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create a test pool
pool1 = self.create_pool()
Expand All @@ -218,7 +221,7 @@ def test_dm_bad_params_fs_copy(self):
uns_cont = self.get_container(pool1)

# Create a test container
cont1_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
cont1_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
cont1 = self.get_container(pool1, path=cont1_path)

# Create test files
Expand Down
10 changes: 6 additions & 4 deletions src/tests/ftest/datamover/posix_meta_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from os.path import join

from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse
from exception_utils import CommandFailure


Expand Down Expand Up @@ -62,7 +63,8 @@ def run_dm_posix_meta_entry(self, tool):
test_desc = self.test_id + " (preserve={})".format(str(preserve_on))

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create 1 pool
pool1 = self.create_pool()
Expand All @@ -71,7 +73,7 @@ def run_dm_posix_meta_entry(self, tool):
cont1 = self.get_container(pool1)
daos_src_path = self.new_daos_test_path(False)
dfuse_src_path = "{}/{}/{}{}".format(
self.dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_src_path)
dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_src_path)
self.create_data(dfuse_src_path)

# Create 1 source posix path with test data
Expand All @@ -84,7 +86,7 @@ def run_dm_posix_meta_entry(self, tool):
# DAOS -> DAOS
daos_dst_path = self.new_daos_test_path(False)
dfuse_dst_path = "{}/{}/{}{}".format(
self.dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_dst_path)
dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_dst_path)
self.run_datamover(
test_desc + "(DAOS->DAOS)",
"DAOS", daos_src_path, pool1, cont1,
Expand All @@ -105,7 +107,7 @@ def run_dm_posix_meta_entry(self, tool):
# POSIX -> DAOS
daos_dst_path = self.new_daos_test_path(False)
dfuse_dst_path = "{}/{}/{}{}".format(
self.dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_dst_path)
dfuse.mount_dir.value, pool1.uuid, cont1.uuid, daos_dst_path)
self.run_datamover(
test_desc + "(POSIX->DAOS)",
"POSIX", posix_src_path, None, None,
Expand Down
11 changes: 6 additions & 5 deletions src/tests/ftest/datamover/posix_subsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from os.path import join

from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse


class DmvrPosixSubsets(DataMoverTestBase):
Expand Down Expand Up @@ -49,21 +50,21 @@ def run_dm_posix_subsets(self, tool):
self.set_tool(tool)

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create 1 pool
pool1 = self.create_pool()

# create dfuse containers to test copying to dfuse subdirectories
dfuse_cont1 = self.get_container(pool1)
dfuse_cont2 = self.get_container(pool1)
dfuse_src_dir = join(self.dfuse.mount_dir.value, pool1.uuid, dfuse_cont1.uuid)
dfuse_src_dir = join(dfuse.mount_dir.value, pool1.uuid, dfuse_cont1.uuid)
# Create a special container to hold UNS entries
uns_cont = self.get_container(pool1)

# Create two test containers
container1_path = join(
self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1 = self.get_container(pool1, path=container1_path)
container2 = self.get_container(pool1)

Expand Down Expand Up @@ -128,7 +129,7 @@ def run_dm_posix_subsets(self, tool):

dfuse_dst_dir = self.new_posix_test_path(
create=False,
parent=join(self.dfuse.mount_dir.value, pool1.uuid, dfuse_cont2.uuid))
parent=join(dfuse.mount_dir.value, pool1.uuid, dfuse_cont2.uuid))
copy_list.append([
"copy_subsets (dfuse root to new dfuse dir)",
["POSIX", dfuse_src_dir, None, None],
Expand Down
10 changes: 6 additions & 4 deletions src/tests/ftest/datamover/posix_symlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from os.path import join

from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse


class DmvrPosixSymlinks(DataMoverTestBase):
Expand Down Expand Up @@ -55,7 +56,8 @@ def run_dm_posix_symlinks(self, tool):
self.set_tool(tool)

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create 1 pool
pool1 = self.create_pool()
Expand All @@ -64,19 +66,19 @@ def run_dm_posix_symlinks(self, tool):
uns_cont = self.get_container(pool1)

# Test links that point forward
container1_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1 = self.get_container(pool1, path=container1_path)
self.run_dm_posix_symlinks_fun(
pool1, container1, self.create_links_forward, "forward")

# Test links that point backward
container2_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns2')
container2_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns2')
container2 = self.get_container(pool1, path=container2_path)
self.run_dm_posix_symlinks_fun(
pool1, container2, self.create_links_backward, "backward")

# Test a mix of forward and backward links
container3_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns3')
container3_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns3')
container3 = self.get_container(pool1, path=container3_path)
self.run_dm_posix_symlinks_fun(
pool1, container3, self.create_links_mixed, "mixed")
Expand Down
10 changes: 6 additions & 4 deletions src/tests/ftest/datamover/posix_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from os.path import basename, join

from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse
from duns_utils import format_path, parse_path


Expand Down Expand Up @@ -63,7 +64,8 @@ def run_dm_posix_types(self, tool):
self.set_tool(tool)

# Start dfuse to hold all pools/containers
self.start_dfuse(self.dfuse_hosts)
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse)

# Create 2 pools
pool1 = self.create_pool(label='pool1')
Expand All @@ -73,11 +75,11 @@ def run_dm_posix_types(self, tool):
uns_cont = self.get_container(pool1)

# Create all other containers
container1_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns1')
container1 = self.get_container(pool1, path=container1_path, label='container1')
container2_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns2')
container2_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns2')
container2 = self.get_container(pool1, path=container2_path, label='container2')
container3_path = join(self.dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns3')
container3_path = join(dfuse.mount_dir.value, pool1.uuid, uns_cont.uuid, 'uns3')
container3 = self.get_container(pool2, path=container3_path, label='container3')

# Create each source location
Expand Down
6 changes: 4 additions & 2 deletions src/tests/ftest/datamover/serial_large_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
'''
from data_mover_test_base import DataMoverTestBase
from dfuse_utils import get_dfuse, start_dfuse
from duns_utils import format_path


Expand Down Expand Up @@ -54,8 +55,9 @@ def run_dm_serial_large_posix(self, tool):

# Use dfuse as a shared intermediate for serialize + deserialize
dfuse_cont = self.get_container(pool1)
self.start_dfuse(self.dfuse_hosts, pool1, dfuse_cont)
self.serial_tmp_dir = self.dfuse.mount_dir.value
dfuse = get_dfuse(self, self.dfuse_hosts)
start_dfuse(self, dfuse, pool1, dfuse_cont)
self.serial_tmp_dir = dfuse.mount_dir.value

# Serialize/Deserialize cont1 to a new cont2 in pool2
result = self.run_datamover(
Expand Down
Loading
Loading