Skip to content

Commit

Permalink
Z.I.A. Testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lee <[email protected]>
  • Loading branch information
calccrypto committed Mar 27, 2024
1 parent 4b1566b commit 6d625f7
Show file tree
Hide file tree
Showing 10 changed files with 404 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,7 @@ tags = ['functional', 'zvol', 'zvol_misc']
tests = ['idmap_mount_001', 'idmap_mount_002', 'idmap_mount_003',
'idmap_mount_004', 'idmap_mount_005']
tags = ['functional', 'idmap_mount']

[tests/functional/zia:Linux]
tests = ['zia_props', 'zia_write_pipeline', 'zia_raidz_resilver']
tags = ['functional', 'zia']
2 changes: 2 additions & 0 deletions tests/zfs-tests/include/commands.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export SYSTEM_FILES_LINUX='attr
groupdel
groupmod
hostid
insmod
logger
losetup
lsattr
Expand All @@ -153,6 +154,7 @@ export SYSTEM_FILES_LINUX='attr
nsenter
parted
perf
rmmod
setfattr
setpriv
sha256sum
Expand Down
11 changes: 9 additions & 2 deletions tests/zfs-tests/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ nobase_dist_datadir_zfs_tests_tests_DATA += \
functional/zvol/zvol_misc/zvol_misc_common.kshlib \
functional/zvol/zvol_swap/zvol_swap.cfg \
functional/idmap_mount/idmap_mount.cfg \
functional/idmap_mount/idmap_mount_common.kshlib
functional/idmap_mount/idmap_mount_common.kshlib \
functional/zia/zia.cfg \
functional/zia/zia.kshlib

nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/acl/off/cleanup.ksh \
Expand Down Expand Up @@ -2111,4 +2113,9 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/idmap_mount/idmap_mount_002.ksh \
functional/idmap_mount/idmap_mount_003.ksh \
functional/idmap_mount/idmap_mount_004.ksh \
functional/idmap_mount/idmap_mount_005.ksh
functional/idmap_mount/idmap_mount_005.ksh \
functional/zia/cleanup.ksh \
functional/zia/setup.ksh \
functional/zia/zia_props.ksh \
functional/zia/zia_raidz_resilver.ksh \
functional/zia/zia_write_pipeline.ksh
37 changes: 37 additions & 0 deletions tests/zfs-tests/tests/functional/zia/cleanup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2022-2024 by Triad National Security, LCC
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.kshlib

verify_runnable "global"

lsmod | grep dpusm > /dev/null
ret="$?"
(( "${ret}" != "0" )) && log_unsupported "dpusm not loaded"

log_must unload_provider
default_cleanup
44 changes: 44 additions & 0 deletions tests/zfs-tests/tests/functional/zia/setup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2022-2024 by Triad National Security, LCC
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.kshlib
verify_runnable "global"

# dpusm needs to be loaded before ZFS
lsmod | grep dpusm > /dev/null
ret="$?"
(( "${ret}" != "0" )) && log_unsupported "dpusm not loaded"

# unload the software provider if the test starts with it loaded
lsmod | grep "${PROVIDER_MODULE}" > /dev/null
ret="$?"
(( "${ret}" == "0" )) && log_must rmmod "${PROVIDER_MODULE}"

log_must default_zpool
log_must load_provider

log_pass
32 changes: 32 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2022-2024 by Triad National Security, LCC
#

export PROVIDER_MODULE="zia_software_provider"
export PROVIDER="zia-software-provider"
export BLOCKSZ=8192
export NUM_WRITES=65536
export DATA="R"
export FILENAME="${TESTDIR}/file"
export RESILVER_REPLACEMENT="${TEST_BASE_DIR}/replacement"
112 changes: 112 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia.kshlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2023, 2024 by Triad National Security, LCC
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
. $STF_SUITE/tests/functional/zia/zia.cfg

function default_zpool
{
default_raidz_setup_noexit "${DISKS}"
log_must zfs set compression=on "${TESTPOOL}"
log_must zfs set checksum=on "${TESTPOOL}"
}

# providers can be loaded at any time after the dpusm
#
# the software provider must be loaded after ZFS since
# it uses ZFS symbols
function load_provider
{
log_must insmod "${SBIN_DIR}/module/${PROVIDER}.ko"
log_must zpool set zia_provider="${PROVIDER}" "${TESTPOOL}"
}

function unload_provider
{
log_must zpool set zia_provider="" "${TESTPOOL}"
log_must rmmod "${PROVIDER_MODULE}"
}

function offload_all
{
log_must zpool set zia_compress="on" "${TESTPOOL}"
log_must zpool set zia_checksum="on" "${TESTPOOL}"
log_must zpool set zia_raidz1_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz2_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz3_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz1_rec="on" "${TESTPOOL}"
log_must zpool set zia_raidz2_rec="on" "${TESTPOOL}"
log_must zpool set zia_raidz3_rec="on" "${TESTPOOL}"
log_must zpool set zia_disk_write="on" "${TESTPOOL}"
log_must zpool set zia_file_write="on" "${TESTPOOL}"
}

#
# loop through each combination of Z.I.A. offloads
# and make sure writing works
#
function loop_offloads_and_write
{
for comp in on off
do
log_must zpool set zia_compress="${comp}" "${TESTPOOL}"

for cksum in on off
do
log_must zpool set zia_checksum="${cksum}" "${TESTPOOL}"

for raidz in on off
do
log_must zpool set zia_raidz1_gen="${raidz}" "${TESTPOOL}"
log_must zpool set zia_raidz2_gen="${raidz}" "${TESTPOOL}"
log_must zpool set zia_raidz3_gen="${raidz}" "${TESTPOOL}"

for diskfile in on off
do
log_must zpool set zia_disk_write="${diskfile}" "${TESTPOOL}"
log_must zpool set zia_file_write="${diskfile}" "${TESTPOOL}"

log_must file_write -o create -f "${FILENAME}" -b "${BLOCKSZ}" -c "${NUM_WRITES}" -d "${DATA}"
log_must ls -l "${FILENAME}"
log_must verify_pool "${TESTPOOL}"
log_must check_pool_status "${TESTPOOL}" "errors" "No known data errors"
log_must rm "${FILENAME}"
done
done
done
done
}

# copied from default_raidz_setup_noexit
function random_disk
{
typeset disklist="$*"
disks=(${disklist[*]})
count="${#disks[*]}"
idx="$(($(random 1 ${count}) - 1))"
echo "${disks[${idx}]}"
}
53 changes: 53 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia_props.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2023, 2024 by Triad National Security, LCC
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.kshlib

#
# DESCRIPTION:
# Z.I.A. zpool settings work
#
# STRATEGY:
# 1. Turn on all offloads
# 2. Run zpool get on each property
#

log_must offload_all

log_must zpool get zia_provider "${TESTPOOL}"
log_must zpool get zia_compress "${TESTPOOL}"
log_must zpool get zia_checksum "${TESTPOOL}"
log_must zpool get zia_raidz1_gen "${TESTPOOL}"
log_must zpool get zia_raidz2_gen "${TESTPOOL}"
log_must zpool get zia_raidz3_gen "${TESTPOOL}"
log_must zpool get zia_raidz1_rec "${TESTPOOL}"
log_must zpool get zia_raidz2_rec "${TESTPOOL}"
log_must zpool get zia_raidz3_rec "${TESTPOOL}"
log_must zpool get zia_disk_write "${TESTPOOL}"
log_must zpool get zia_file_write "${TESTPOOL}"

log_pass
65 changes: 65 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia_raidz_resilver.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2022-2024 by Triad National Security, LCC
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.kshlib

#
# DESCRIPTION:
# Z.I.A. RAIDZ Resilver works
#
# STRATEGY:
# 1. Turn on all offloads
# 2. Write data to the zpool
# 3. Replace a drive
# 4. Resilver the zpool with Z.I.A.
# 5. Check for errors
#

log_must truncate -s 4G "${RESILVER_REPLACEMENT}"

function cleanup
{
log_must rm "${RESILVER_REPLACEMENT}"
}
log_onexit cleanup

log_must offload_all

# write a file
log_must file_write -o create -f "${FILENAME}" -b "${BLOCKSZ}" -c "${NUM_WRITES}" -d "${DATA}"
log_must ls -l "${FILENAME}"

# pick a random backing device to offline and replace it
bad="$(random_disk ${DISKS})"
log_must zpool offline "${TESTPOOL}" "${bad}"
log_must zpool replace "${TESTPOOL}" "${bad}" "${RESILVER_REPLACEMENT}"
log_must wait_replacing "${TESTPOOL}"

log_must verify_pool "${TESTPOOL}"
log_must check_pool_status "${TESTPOOL}" "errors" "No known data errors"

log_pass
Loading

0 comments on commit 6d625f7

Please sign in to comment.