mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Distributed Spare (dRAID) Feature
This patch adds a new top-level vdev type called dRAID, which stands
for Distributed parity RAID. This pool configuration allows all dRAID
vdevs to participate when rebuilding to a distributed hot spare device.
This can substantially reduce the total time required to restore full
parity to pool with a failed device.
A dRAID pool can be created using the new top-level `draid` type.
Like `raidz`, the desired redundancy is specified after the type:
`draid[1,2,3]`. No additional information is required to create the
pool and reasonable default values will be chosen based on the number
of child vdevs in the dRAID vdev.
zpool create <pool> draid[1,2,3] <vdevs...>
Unlike raidz, additional optional dRAID configuration values can be
provided as part of the draid type as colon separated values. This
allows administrators to fully specify a layout for either performance
or capacity reasons. The supported options include:
zpool create <pool> \
draid[<parity>][:<data>d][:<children>c][:<spares>s] \
<vdevs...>
- draid[parity] - Parity level (default 1)
- draid[:<data>d] - Data devices per group (default 8)
- draid[:<children>c] - Expected number of child vdevs
- draid[:<spares>s] - Distributed hot spares (default 0)
Abbreviated example `zpool status` output for a 68 disk dRAID pool
with two distributed spares using special allocation classes.
```
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
slag7 ONLINE 0 0 0
draid2:8d:68c:2s-0 ONLINE 0 0 0
L0 ONLINE 0 0 0
L1 ONLINE 0 0 0
...
U25 ONLINE 0 0 0
U26 ONLINE 0 0 0
spare-53 ONLINE 0 0 0
U27 ONLINE 0 0 0
draid2-0-0 ONLINE 0 0 0
U28 ONLINE 0 0 0
U29 ONLINE 0 0 0
...
U42 ONLINE 0 0 0
U43 ONLINE 0 0 0
special
mirror-1 ONLINE 0 0 0
L5 ONLINE 0 0 0
U5 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
L6 ONLINE 0 0 0
U6 ONLINE 0 0 0
spares
draid2-0-0 INUSE currently in use
draid2-0-1 AVAIL
```
When adding test coverage for the new dRAID vdev type the following
options were added to the ztest command. These options are leverages
by zloop.sh to test a wide range of dRAID configurations.
-K draid|raidz|random - kind of RAID to test
-D <value> - dRAID data drives per group
-S <value> - dRAID distributed hot spares
-R <value> - RAID parity (raidz or dRAID)
The zpool_create, zpool_import, redundancy, replacement and fault
test groups have all been updated provide test coverage for the
dRAID feature.
Co-authored-by: Isaac Huang <he.huang@intel.com>
Co-authored-by: Mark Maybee <mmaybee@cray.com>
Co-authored-by: Don Brady <don.brady@delphix.com>
Co-authored-by: Matthew Ahrens <mahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mmaybee@cray.com>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10102
This commit is contained in:
@@ -6,6 +6,7 @@ SUBDIRS = \
|
||||
chg_usr_exec \
|
||||
devname2devid \
|
||||
dir_rd_update \
|
||||
draid \
|
||||
file_check \
|
||||
file_trunc \
|
||||
file_write \
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/draid
|
||||
@@ -0,0 +1,15 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
|
||||
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
|
||||
|
||||
AM_CFLAGS += $(ZLIB_CFLAGS)
|
||||
|
||||
pkgexec_PROGRAMS = draid
|
||||
|
||||
draid_SOURCES = draid.c
|
||||
|
||||
draid_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzpool/libzpool.la \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
draid_LDADD += $(ZLIB_LIBS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -197,6 +197,7 @@ export ZFSTEST_FILES='badsend
|
||||
chg_usr_exec
|
||||
devname2devid
|
||||
dir_rd_update
|
||||
draid
|
||||
file_check
|
||||
file_trunc
|
||||
file_write
|
||||
|
||||
@@ -2336,7 +2336,7 @@ function check_pool_status # pool token keyword <verbose>
|
||||
function is_pool_resilvering #pool <verbose>
|
||||
{
|
||||
check_pool_status "$1" "scan" \
|
||||
"resilver[ ()0-9A-Za-z_-]* in progress since" $2
|
||||
"resilver[ ()0-9A-Za-z:_-]* in progress since" $2
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ MULTIHOST_IMPORT_INTERVALS multihost.import_intervals zfs_multihost_import_inter
|
||||
MULTIHOST_INTERVAL multihost.interval zfs_multihost_interval
|
||||
OVERRIDE_ESTIMATE_RECORDSIZE send.override_estimate_recordsize zfs_override_estimate_recordsize
|
||||
PREFETCH_DISABLE prefetch.disable zfs_prefetch_disable
|
||||
REBUILD_SCRUB_ENABLED rebuild_scrub_enabled zfs_rebuild_scrub_enabled
|
||||
REMOVAL_SUSPEND_PROGRESS removal_suspend_progress zfs_removal_suspend_progress
|
||||
REMOVE_MAX_SEGMENT remove_max_segment zfs_remove_max_segment
|
||||
RESILVER_MIN_TIME_MS resilver_min_time_ms zfs_resilver_min_time_ms
|
||||
|
||||
@@ -66,7 +66,8 @@ function setup_filesystem #disklist #pool #fs #mntpoint #type #vdev
|
||||
|
||||
if [[ $vdev != "" && \
|
||||
$vdev != "mirror" && \
|
||||
$vdev != "raidz" ]] ; then
|
||||
$vdev != "raidz" && \
|
||||
$vdev != "draid" ]] ; then
|
||||
|
||||
log_note "Wrong vdev: (\"$vdev\")"
|
||||
return 1
|
||||
|
||||
@@ -55,23 +55,26 @@ log_assert "'zpool add <pool> <vdev> ...' can add devices to the pool."
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
set -A keywords "" "mirror" "raidz" "raidz1" "spare"
|
||||
set -A keywords "" "mirror" "raidz" "raidz1" "draid:1s" "draid1:1s" "spare"
|
||||
|
||||
pooldevs="${DISK0} \
|
||||
\"${DISK0} ${DISK1}\" \
|
||||
\"${DISK0} ${DISK1} ${DISK2}\""
|
||||
mirrordevs="\"${DISK0} ${DISK1}\""
|
||||
raidzdevs="\"${DISK0} ${DISK1}\""
|
||||
draiddevs="\"${DISK0} ${DISK1} ${DISK2}\""
|
||||
|
||||
disk0=$TEST_BASE_DIR/disk0
|
||||
disk1=$TEST_BASE_DIR/disk1
|
||||
truncate -s $MINVDEVSIZE $disk0 $disk1
|
||||
disk2=$TEST_BASE_DIR/disk2
|
||||
truncate -s $MINVDEVSIZE $disk0 $disk1 $disk2
|
||||
|
||||
typeset -i i=0
|
||||
typeset vdev
|
||||
eval set -A poolarray $pooldevs
|
||||
eval set -A mirrorarray $mirrordevs
|
||||
eval set -A raidzarray $raidzdevs
|
||||
eval set -A draidarray $draiddevs
|
||||
|
||||
while (( $i < ${#keywords[*]} )); do
|
||||
|
||||
@@ -107,6 +110,19 @@ while (( $i < ${#keywords[*]} )); do
|
||||
destroy_pool "$TESTPOOL"
|
||||
done
|
||||
|
||||
;;
|
||||
draid:1s|draid1:1s)
|
||||
for vdev in "${draidarray[@]}"; do
|
||||
create_pool "$TESTPOOL" "${keywords[i]}" \
|
||||
"$disk0" "$disk1" "$disk2"
|
||||
log_must poolexists "$TESTPOOL"
|
||||
log_must zpool add "$TESTPOOL" ${keywords[i]} $vdev
|
||||
log_must vdevs_in_pool "$TESTPOOL" "$vdev"
|
||||
log_must vdevs_in_pool "$TESTPOOL" "draid1-0-0"
|
||||
log_must vdevs_in_pool "$TESTPOOL" "draid1-1-0"
|
||||
destroy_pool "$TESTPOOL"
|
||||
done
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ dist_pkgdata_SCRIPTS = \
|
||||
zpool_create_024_pos.ksh \
|
||||
zpool_create_encrypted.ksh \
|
||||
zpool_create_crypt_combos.ksh \
|
||||
zpool_create_draid_001_pos.ksh \
|
||||
zpool_create_draid_002_pos.ksh \
|
||||
zpool_create_draid_003_pos.ksh \
|
||||
zpool_create_draid_004_pos.ksh \
|
||||
zpool_create_features_001_pos.ksh \
|
||||
zpool_create_features_002_pos.ksh \
|
||||
zpool_create_features_003_pos.ksh \
|
||||
@@ -36,5 +40,6 @@ dist_pkgdata_SCRIPTS = \
|
||||
zpool_create_tempname.ksh
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
draidcfg.gz \
|
||||
zpool_create.cfg \
|
||||
zpool_create.shlib
|
||||
|
||||
Binary file not shown.
@@ -64,14 +64,16 @@ pooldevs="${DISK0} \
|
||||
\"${DISK0} ${DISK1}\" \
|
||||
\"${DISK0} ${DISK1} ${DISK2}\" \
|
||||
\"$disk1 $disk2\""
|
||||
raidzdevs="\"${DISK0} ${DISK1} ${DISK2}\""
|
||||
mirrordevs="\"${DISK0} ${DISK1}\" \
|
||||
$raidzdevs \
|
||||
\"$disk1 $disk2\""
|
||||
raidzdevs="\"${DISK0} ${DISK1} ${DISK2}\""
|
||||
draiddevs="\"${DISK0} ${DISK1} ${DISK2}\""
|
||||
|
||||
create_pool_test "$TESTPOOL" "" "$pooldevs"
|
||||
create_pool_test "$TESTPOOL" "mirror" "$mirrordevs"
|
||||
create_pool_test "$TESTPOOL" "raidz" "$raidzdevs"
|
||||
create_pool_test "$TESTPOOL" "raidz1" "$raidzdevs"
|
||||
create_pool_test "$TESTPOOL" "draid" "$draiddevs"
|
||||
|
||||
log_pass "'zpool create <pool> <vspec> ...' success."
|
||||
|
||||
@@ -54,7 +54,7 @@ log_assert "'zpool create [-R root][-m mountpoint] <pool> <vdev> ...' can create
|
||||
"an alternate pool or a new pool mounted at the specified mountpoint."
|
||||
log_onexit cleanup
|
||||
|
||||
set -A pooltype "" "mirror" "raidz" "raidz1" "raidz2"
|
||||
set -A pooltype "" "mirror" "raidz" "raidz1" "raidz2" "draid" "draid2"
|
||||
|
||||
#
|
||||
# cleanup the pools created in previous case if zpool_create_004_pos timedout
|
||||
@@ -67,8 +67,8 @@ done
|
||||
rm -rf $TESTDIR
|
||||
log_must mkdir -p $TESTDIR
|
||||
typeset -i i=1
|
||||
while (( i < 4 )); do
|
||||
log_must mkfile $FILESIZE $TESTDIR/file.$i
|
||||
while (( i < 5 )); do
|
||||
log_must truncate -s $FILESIZE $TESTDIR/file.$i
|
||||
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
@@ -87,7 +87,7 @@ do
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
[[ -d $TESTDIR1 ]] && rm -rf $TESTDIR1
|
||||
log_must zpool create $opt $TESTPOOL ${pooltype[i]} \
|
||||
$file.1 $file.2 $file.3
|
||||
$file.1 $file.2 $file.3 $file.4
|
||||
! poolexists $TESTPOOL && \
|
||||
log_fail "Creating pool with $opt fails."
|
||||
mpt=`zfs mount | egrep "^$TESTPOOL[^/]" | awk '{print $2}'`
|
||||
|
||||
@@ -97,6 +97,20 @@ set -A valid_args \
|
||||
"raidz2 $vdev0 $vdev1 $vdev2 spare $vdev3 raidz2 $vdev4 $vdev5 $vdev6" \
|
||||
"raidz3 $vdev0 $vdev1 $vdev2 $vdev3 \
|
||||
mirror $vdev4 $vdev5 $vdev6 $vdev7" \
|
||||
"draid $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4" \
|
||||
"draid $vdev0 $vdev1 $vdev2 raidz1 $vdev3 $vdev4 $vdev5" \
|
||||
"draid $vdev0 $vdev1 $vdev2 draid1 $vdev3 $vdev4 $vdev5" \
|
||||
"draid $vdev0 $vdev1 $vdev2 special mirror $vdev3 $vdev4" \
|
||||
"draid2 $vdev0 $vdev1 $vdev2 $vdev3 mirror $vdev4 $vdev5 $vdev6" \
|
||||
"draid2 $vdev0 $vdev1 $vdev2 $vdev3 raidz2 $vdev4 $vdev5 $vdev6" \
|
||||
"draid2 $vdev0 $vdev1 $vdev2 $vdev3 draid2 $vdev4 $vdev5 $vdev6 $vdev7"\
|
||||
"draid2 $vdev0 $vdev1 $vdev2 $vdev3 \
|
||||
special mirror $vdev4 $vdev5 $vdev6" \
|
||||
"draid2 $vdev0 $vdev1 $vdev2 $vdev3 \
|
||||
special mirror $vdev4 $vdev5 $vdev6 \
|
||||
cache $vdev7 log mirror $vdev8 $vdev9" \
|
||||
"draid $vdev0 $vdev1 $vdev2 draid $vdev4 $vdev5 $vdev6 $vdev7 \
|
||||
special mirror $vdev8 $vdev9" \
|
||||
"spare $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4 raidz $vdev5 $vdev6"
|
||||
|
||||
set -A forced_args \
|
||||
@@ -109,11 +123,19 @@ set -A forced_args \
|
||||
"raidz $vdev0 $vdev1 raidz2 $vdev2 $vdev3 $vdev4" \
|
||||
"raidz $vdev0 $vdev1 raidz2 $vdev2 $vdev3 $vdev4 spare $vdev5" \
|
||||
"raidz $vdev0 $vdev1 spare $vdev2 raidz2 $vdev3 $vdev4 $vdev5" \
|
||||
"raidz $vdev0 $vdev1 draid2 $vdev2 $vdev3 $vdev4 $vdev5" \
|
||||
"raidz $vdev0 $vdev1 draid3 $vdev2 $vdev3 $vdev4 $vdev5 $vdev6" \
|
||||
"mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 raidz2 $vdev4 $vdev5 $vdev6" \
|
||||
"mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 \
|
||||
raidz2 $vdev4 $vdev5 $vdev6 spare $vdev7" \
|
||||
"mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 \
|
||||
spare $vdev4 raidz2 $vdev5 $vdev6 $vdev7" \
|
||||
"mirror $vdev0 $vdev1 draid $vdev2 $vdev3 $vdev4 \
|
||||
draid2 $vdev5 $vdev6 $vdev7 $vdev8 spare $vdev9" \
|
||||
"draid $vdev0 $vdev1 $vdev2 $vdev3 \
|
||||
draid2 $vdev4 $vdev5 $vdev6 $vdev7 $vdev8" \
|
||||
"draid $vdev0 $vdev1 $vdev2 draid $vdev4 $vdev5 $vdev6 \
|
||||
special mirror $vdev7 $vdev8 $vdev9" \
|
||||
"spare $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4 \
|
||||
raidz2 $vdev5 $vdev6 $vdev7"
|
||||
|
||||
|
||||
@@ -54,13 +54,16 @@ set -A args "" "-?" "-n" "-f" "-nf" "-fn" "-f -n" "--f" "-e" "-s" \
|
||||
"$TESTPOOL c0txd0" "$TESTPOOL c0t0dx" "$TESTPOOL cxtxdx" \
|
||||
"$TESTPOOL mirror" "$TESTPOOL raidz" "$TESTPOOL mirror raidz" \
|
||||
"$TESTPOOL raidz1" "$TESTPOOL mirror raidz1" \
|
||||
"$TESTPOOL draid1" "$TESTPOOL mirror draid1" \
|
||||
"$TESTPOOL mirror c?t?d?" "$TESTPOOL mirror $DISK0 c0t1d?" \
|
||||
"$TESTPOOL RAIDZ $DISK0 $DISK1" \
|
||||
"$TESTPOOL $DISK0 log $DISK1 log $DISK2" \
|
||||
"$TESTPOOL $DISK0 spare $DISK1 spare $DISK2" \
|
||||
"$TESTPOOL RAIDZ1 $DISK0 $DISK1" \
|
||||
"$TESTPOOL MIRROR $DISK0" "$TESTPOOL raidz $DISK0" \
|
||||
"$TESTPOOL raidz1 $DISK0" \
|
||||
"$TESTPOOL RAIDZ1 $DISK0 $DISK1" "$TESTPOOL MIRROR $DISK0" \
|
||||
"$TESTPOOL DRAID $DISK1 $DISK2 $DISK3" "$TESTPOOL raidz $DISK0" \
|
||||
"$TESTPOOL raidz1 $DISK0" "$TESTPOOL draid $DISK0" \
|
||||
"$TESTPOOL draid2 $DISK0 $DISK1" \
|
||||
"$TESTPOOL draid $DISK0 $DISK1 $DISK2 spare s0-draid1-0" \
|
||||
"1tank $DISK0" "1234 $DISK0" "?tank $DISK0" \
|
||||
"tan%k $DISK0" "ta@# $DISK0" "tan+k $DISK0" \
|
||||
"$BYND_MAX_NAME $DISK0"
|
||||
|
||||
@@ -63,7 +63,7 @@ log_onexit cleanup
|
||||
|
||||
unset NOINUSE_CHECK
|
||||
typeset opt
|
||||
for opt in "" "mirror" "raidz" "raidz1"; do
|
||||
for opt in "" "mirror" "raidz" "draid"; do
|
||||
if [[ $opt == "" ]]; then
|
||||
typeset disks=$DISK0
|
||||
else
|
||||
|
||||
@@ -63,15 +63,16 @@ log_must zfs create $TESTPOOL/$TESTFS
|
||||
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
|
||||
typeset -l devsize=$(($SPA_MINDEVSIZE - 1024 * 1024))
|
||||
for files in $TESTDIR/file1 $TESTDIR/file2
|
||||
for files in $TESTDIR/file1 $TESTDIR/file2 $TESTDIR/file3
|
||||
do
|
||||
log_must mkfile $devsize $files
|
||||
log_must truncate -s $devsize $files
|
||||
done
|
||||
|
||||
set -A args \
|
||||
"$TOOSMALL $TESTDIR/file1" "$TESTPOOL1 $TESTDIR/file1 $TESTDIR/file2" \
|
||||
"$TOOSMALL mirror $TESTDIR/file1 $TESTDIR/file2" \
|
||||
"$TOOSMALL raidz $TESTDIR/file1 $TESTDIR/file2"
|
||||
"$TOOSMALL raidz $TESTDIR/file1 $TESTDIR/file2" \
|
||||
"$TOOSMALL draid $TESTDIR/file1 $TESTDIR/file2 $TESTDIR/file3"
|
||||
|
||||
typeset -i i=0
|
||||
while [[ $i -lt ${#args[*]} ]]; do
|
||||
|
||||
@@ -54,7 +54,7 @@ function cleanup
|
||||
destroy_pool $pool
|
||||
done
|
||||
|
||||
rm -rf $disk1 $disk2 $disk3
|
||||
rm -rf $disk1 $disk2 $disk3 $disk4
|
||||
|
||||
if [[ -n $saved_dump_dev ]]; then
|
||||
log_must dumpadm -u -d $saved_dump_dev
|
||||
@@ -66,12 +66,16 @@ log_onexit cleanup
|
||||
|
||||
disk1=$(create_blockfile $FILESIZE)
|
||||
disk2=$(create_blockfile $FILESIZE)
|
||||
disk3=$(create_blockfile $FILESIZE1)
|
||||
disk3=$(create_blockfile $FILESIZE)
|
||||
disk4=$(create_blockfile $FILESIZE1)
|
||||
mirror1="$DISK0 $DISK1"
|
||||
mirror2="$disk1 $disk2"
|
||||
raidz1=$mirror1
|
||||
raidz2=$mirror2
|
||||
diff_size_dev="$disk2 $disk3"
|
||||
draid1="$DISK0 $DISK1 $DISK2"
|
||||
draid2="$disk1 $disk2 $disk3"
|
||||
diff_size_dev="$disk2 $disk4"
|
||||
draid_diff_size_dev="$disk1 $disk2 $disk4"
|
||||
vfstab_dev=$(find_vfstab_dev)
|
||||
|
||||
if is_illumos; then
|
||||
@@ -91,13 +95,17 @@ set -A arg \
|
||||
"$TESTPOOL1 mirror mirror $mirror1 mirror $mirror2" \
|
||||
"$TESTPOOL1 raidz raidz $raidz1 raidz $raidz2" \
|
||||
"$TESTPOOL1 raidz1 raidz1 $raidz1 raidz1 $raidz2" \
|
||||
"$TESTPOOL1 draid draid $draid draid $draid2" \
|
||||
"$TESTPOOL1 mirror raidz $raidz1 raidz $raidz2" \
|
||||
"$TESTPOOL1 mirror raidz1 $raidz1 raidz1 $raidz2" \
|
||||
"$TESTPOOL1 mirror draid $draid1 draid $draid2" \
|
||||
"$TESTPOOL1 raidz mirror $mirror1 mirror $mirror2" \
|
||||
"$TESTPOOL1 raidz1 mirror $mirror1 mirror $mirror2" \
|
||||
"$TESTPOOL1 draid1 mirror $mirror1 mirror $mirror2" \
|
||||
"$TESTPOOL1 mirror $diff_size_dev" \
|
||||
"$TESTPOOL1 raidz $diff_size_dev" \
|
||||
"$TESTPOOL1 raidz1 $diff_size_dev" \
|
||||
"$TESTPOOL1 draid1 $draid_diff_size_dev" \
|
||||
"$TESTPOOL1 mirror $mirror1 spare $mirror2 spare $diff_size_dev" \
|
||||
"$TESTPOOL1 $vfstab_dev" \
|
||||
"$TESTPOOL1 ${DISK0}s10" \
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 Lawrence Livermore National Security, LLC.
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Create a variety of dRAID pools using the minimal dRAID vdev syntax.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1) Create the required number of allowed dRAID vdevs.
|
||||
# 2) Create few pools of various sizes using the draid1|draid2|draid3 syntax.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
poolexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
|
||||
rm -f $all_vdevs
|
||||
rmdir $TESTDIR
|
||||
}
|
||||
|
||||
log_assert "'zpool create <pool> <draid1|2|3> ...' can create a pool."
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
all_vdevs=$(echo $TESTDIR/file.{01..84})
|
||||
|
||||
mkdir $TESTDIR
|
||||
log_must truncate -s $MINVDEVSIZE $all_vdevs
|
||||
|
||||
# Verify all configurations up to 24 vdevs.
|
||||
for parity in {1..3}; do
|
||||
for children in {$((parity + 2))..24}; do
|
||||
vdevs=$(echo $TESTDIR/file.{01..${children}})
|
||||
log_must zpool create $TESTPOOL draid$parity $vdevs
|
||||
log_must poolexists $TESTPOOL
|
||||
destroy_pool $TESTPOOL
|
||||
done
|
||||
done
|
||||
|
||||
# Spot check a few large configurations.
|
||||
children_counts="53 84"
|
||||
for children in $children_counts; do
|
||||
vdevs=$(echo $TESTDIR/file.{01..${children}})
|
||||
log_must zpool create $TESTPOOL draid $vdevs
|
||||
log_must poolexists $TESTPOOL
|
||||
destroy_pool $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass "'zpool create <pool> <draid1|2|3> <vdevs> ...' success."
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 Lawrence Livermore National Security, LLC.
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Create dRAID pool using the maximum number of vdevs (255). Then verify
|
||||
# that creating a pool with 256 fails as expected.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1) Verify a pool with fewer than the required vdevs fails.
|
||||
# 2) Verify pools with a valid number of vdevs succeed.
|
||||
# 3) Verify a pool which exceeds the maximum number of vdevs fails.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
poolexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
|
||||
rm -f $all_vdevs
|
||||
rmdir $TESTDIR
|
||||
}
|
||||
|
||||
log_assert "'zpool create <pool> draid <vdevs>'"
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
all_vdevs=$(echo $TESTDIR/file.{01..256})
|
||||
|
||||
mkdir $TESTDIR
|
||||
log_must truncate -s $MINVDEVSIZE $all_vdevs
|
||||
|
||||
# Below maximum dRAID vdev count for specified parity level.
|
||||
log_mustnot zpool create $TESTPOOL draid1 $(echo $TESTDIR/file.{01..01})
|
||||
log_mustnot zpool create $TESTPOOL draid2 $(echo $TESTDIR/file.{01..02})
|
||||
log_mustnot zpool create $TESTPOOL draid3 $(echo $TESTDIR/file.{01..03})
|
||||
|
||||
# Verify pool sizes from 2-10. Values in between are skipped to speed
|
||||
# up the test case but will be exercised by the random pool creation
|
||||
# done in zpool_create_draid_002_pos.ksh.
|
||||
for (( i=2; i<=10; i++ )); do
|
||||
log_must zpool create $TESTPOOL draid:${i}c \
|
||||
$(echo $TESTDIR/file.{01..$i})
|
||||
log_must destroy_pool $TESTPOOL
|
||||
done
|
||||
|
||||
# Verify pool sizes from 254-255.
|
||||
for (( i=254; i<=255; i++ )); do
|
||||
log_must zpool create $TESTPOOL draid:${i}c \
|
||||
$(echo $TESTDIR/file.{01..$i})
|
||||
log_must destroy_pool $TESTPOOL
|
||||
done
|
||||
|
||||
# Exceeds maximum dRAID vdev count (256).
|
||||
log_mustnot zpool create $TESTPOOL draid $(echo $TESTDIR/file.{01..256})
|
||||
|
||||
log_pass "'zpool create <pool> draid <vdevs>'"
|
||||
+112
@@ -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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 Lawrence Livermore National Security, LLC.
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify allowed striped widths (data+parity) and hot spares may be
|
||||
# configured at pool creation time.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1) Test valid stripe/spare combinations given the number of children.
|
||||
# 2) Test invalid stripe/spare/children combinations outside the allow limits.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
poolexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
|
||||
rm -f $draid_vdevs
|
||||
rmdir $TESTDIR
|
||||
}
|
||||
|
||||
log_assert "'zpool create <pool> draid:#d:#c:#s <vdevs>'"
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
mkdir $TESTDIR
|
||||
|
||||
# Generate 10 random valid configurations to test.
|
||||
for (( i=0; i<10; i++ )); do
|
||||
parity=$(random_int_between 1 3)
|
||||
spares=$(random_int_between 0 3)
|
||||
data=$(random_int_between 1 16)
|
||||
|
||||
(( min_children = (data + parity + spares) ))
|
||||
children=$(random_int_between $min_children 32)
|
||||
|
||||
draid="draid${parity}:${data}d:${children}c:${spares}s"
|
||||
|
||||
draid_vdevs=$(echo $TESTDIR/file.{01..$children})
|
||||
log_must truncate -s $MINVDEVSIZE $draid_vdevs
|
||||
|
||||
log_must zpool create $TESTPOOL $draid $draid_vdevs
|
||||
log_must poolexists $TESTPOOL
|
||||
destroy_pool $TESTPOOL
|
||||
|
||||
rm -f $draid_vdevs
|
||||
done
|
||||
|
||||
children=32
|
||||
draid_vdevs=$(echo $TESTDIR/file.{01..$children})
|
||||
log_must truncate -s $MINVDEVSIZE $draid_vdevs
|
||||
|
||||
mkdir $TESTDIR
|
||||
log_must truncate -s $MINVDEVSIZE $draid_vdevs
|
||||
|
||||
# Out of order and unknown suffixes should fail.
|
||||
log_mustnot zpool create $TESTPOOL draid:d8 $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid:s3 $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid:c32 $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid:10x $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid:x10 $draid_vdevs
|
||||
|
||||
# Exceeds maximum data disks (limited by total children)
|
||||
log_must zpool create $TESTPOOL draid2:30d $draid_vdevs
|
||||
log_must destroy_pool $TESTPOOL
|
||||
log_mustnot zpool create $TESTPOOL draid2:31d $draid_vdevs
|
||||
|
||||
# At least one data disk must be requested.
|
||||
log_mustnot zpool create $TESTPOOL draid2:0d $draid_vdevs
|
||||
|
||||
# Check invalid parity levels.
|
||||
log_mustnot zpool create $TESTPOOL draid0 $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid4 $draid_vdevs
|
||||
|
||||
# Spares are limited: spares < children - (parity + data).
|
||||
log_must zpool create $TESTPOOL draid2:20d:10s $draid_vdevs
|
||||
log_must destroy_pool $TESTPOOL
|
||||
log_mustnot zpool create $TESTPOOL draid2:20d:11s $draid_vdevs
|
||||
|
||||
# The required children argument is enforced.
|
||||
log_mustnot zpool create $TESTPOOL draid2:0c $draid_vdevs
|
||||
log_mustnot zpool create $TESTPOOL draid2:31c $draid_vdevs
|
||||
log_must zpool create $TESTPOOL draid2:32c $draid_vdevs
|
||||
destroy_pool $TESTPOOL
|
||||
|
||||
log_pass "'zpool create <pool> draid:#d:#c:#s <vdevs>'"
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify generated dRAID permutation maps against the authoritative
|
||||
# reference file contains the full permutations.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "'draid verify'"
|
||||
|
||||
DRAIDCFG="$STF_SUITE/tests/functional/cli_root/zpool_create/draidcfg.gz"
|
||||
|
||||
log_must draid verify $DRAIDCFG
|
||||
|
||||
log_pass "'draid verify'"
|
||||
@@ -72,7 +72,7 @@ log_onexit cleanup
|
||||
|
||||
log_assert "zpool can be autoexpanded after set autoexpand=on on vdev expansion"
|
||||
|
||||
for type in " " mirror raidz raidz2; do
|
||||
for type in " " mirror raidz draid; do
|
||||
log_note "Setting up loopback, scsi_debug, and file vdevs"
|
||||
log_must truncate -s $org_size $FILE_LO
|
||||
DEV1=$(losetup -f)
|
||||
@@ -144,6 +144,16 @@ for type in " " mirror raidz raidz2; do
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
log_fail "pool $TESTPOOL1 has not expanded"
|
||||
fi
|
||||
elif [[ $type == "draid" ]]; then
|
||||
typeset expansion_size=$((2*($exp_size-$org_size)))
|
||||
zpool history -il $TESTPOOL1 | \
|
||||
grep "pool '$TESTPOOL1' size:" | \
|
||||
grep "vdev online" | \
|
||||
grep "(+${expansion_size})" >/dev/null 2>&1
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_fail "pool $TESTPOOL has not expanded"
|
||||
fi
|
||||
else
|
||||
typeset expansion_size=$((3*($exp_size-$org_size)))
|
||||
zpool history -il $TESTPOOL1 | \
|
||||
|
||||
@@ -63,7 +63,7 @@ log_onexit cleanup
|
||||
|
||||
log_assert "zpool can expand after zpool online -e zvol vdevs on vdev expansion"
|
||||
|
||||
for type in " " mirror raidz raidz2; do
|
||||
for type in " " mirror raidz draid:1s; do
|
||||
# Initialize the file devices and the pool
|
||||
for i in 1 2 3; do
|
||||
log_must truncate -s $org_size ${TEMPFILE}.$i
|
||||
@@ -92,6 +92,8 @@ for type in " " mirror raidz raidz2; do
|
||||
|
||||
if [[ $type == "mirror" ]]; then
|
||||
typeset expected_zpool_expandsize=$(($exp_size-$org_size))
|
||||
elif [[ $type == "draid:1s" ]]; then
|
||||
typeset expected_zpool_expandsize=$((2*($exp_size-$org_size)))
|
||||
else
|
||||
typeset expected_zpool_expandsize=$((3*($exp_size-$org_size)))
|
||||
fi
|
||||
@@ -147,6 +149,17 @@ for type in " " mirror raidz raidz2; do
|
||||
log_fail "pool $TESTPOOL1 has not expanded " \
|
||||
"after zpool online -e"
|
||||
fi
|
||||
elif [[ $type == "draid:1s" ]]; then
|
||||
typeset expansion_size=$((2*($exp_size-$org_size)))
|
||||
zpool history -il $TESTPOOL1 | \
|
||||
grep "pool '$TESTPOOL1' size:" | \
|
||||
grep "vdev online" | \
|
||||
grep "(+${expansion_size})" >/dev/null 2>&1
|
||||
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
log_fail "pool $TESTPOOL1 has not expanded " \
|
||||
"after zpool online -e"
|
||||
fi
|
||||
else
|
||||
typeset expansion_size=$((3*($exp_size-$org_size)))
|
||||
zpool history -il $TESTPOOL1 | \
|
||||
@@ -160,9 +173,17 @@ for type in " " mirror raidz raidz2; do
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_fail "pool $TESTPOOL1 did not expand after vdev expansion " \
|
||||
"and zpool online -e"
|
||||
log_fail "pool $TESTPOOL1 did not expand after vdev " \
|
||||
"expansion and zpool online -e"
|
||||
fi
|
||||
|
||||
# For dRAID pools verify the distributed spare was resized after
|
||||
# expansion and it is large enough to be used to replace a pool vdev.
|
||||
if [[ $type == "draid:1s" ]]; then
|
||||
log_must zpool replace -w $TESTPOOL1 $TEMPFILE.3 draid1-0-0
|
||||
verify_pool $TESTPOOL1
|
||||
fi
|
||||
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
done
|
||||
log_pass "zpool can expand after zpool online -e"
|
||||
|
||||
@@ -73,7 +73,7 @@ log_onexit cleanup
|
||||
|
||||
log_assert "zpool can not expand if set autoexpand=off after vdev expansion"
|
||||
|
||||
for type in " " mirror raidz raidz2; do
|
||||
for type in " " mirror raidz draid; do
|
||||
log_note "Setting up loopback, scsi_debug, and file vdevs"
|
||||
log_must truncate -s $org_size $FILE_LO
|
||||
DEV1=$(losetup -f)
|
||||
|
||||
@@ -61,7 +61,7 @@ log_onexit cleanup
|
||||
|
||||
log_assert "After vdev expansion, all 4 labels have the same set of uberblocks."
|
||||
|
||||
for type in " " mirror raidz raidz2; do
|
||||
for type in " " mirror raidz draid; do
|
||||
for i in 1 2 3; do
|
||||
log_must truncate -s $org_size ${TEMPFILE}.$i
|
||||
done
|
||||
|
||||
@@ -80,6 +80,7 @@ typeset -a properties=(
|
||||
"feature@bookmark_written"
|
||||
"feature@log_spacemap"
|
||||
"feature@device_rebuild"
|
||||
"feature@draid"
|
||||
)
|
||||
|
||||
if is_linux || is_freebsd; then
|
||||
|
||||
@@ -29,6 +29,8 @@ dist_pkgdata_SCRIPTS = \
|
||||
zpool_import_013_neg.ksh \
|
||||
zpool_import_014_pos.ksh \
|
||||
zpool_import_015_pos.ksh \
|
||||
zpool_import_016_pos.ksh \
|
||||
zpool_import_017_pos.ksh \
|
||||
zpool_import_all_001_pos.ksh \
|
||||
zpool_import_features_001_pos.ksh \
|
||||
zpool_import_features_002_neg.ksh \
|
||||
|
||||
+2
@@ -69,6 +69,8 @@ test_add_vdevs "mirror $VDEV0 $VDEV1" "mirror $VDEV2 $VDEV3" \
|
||||
"mirror $VDEV0 $VDEV1 mirror $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "raidz $VDEV1 $VDEV2 $VDEV3" \
|
||||
"$VDEV0 raidz $VDEV1 $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "draid $VDEV1 $VDEV2 $VDEV3" \
|
||||
"$VDEV0 draid $VDEV1 $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "log $VDEV1" "$VDEV0 log $VDEV1"
|
||||
test_add_vdevs "$VDEV0 log $VDEV1" "$VDEV2" "$VDEV0 $VDEV2 log $VDEV1"
|
||||
test_add_vdevs "$VDEV0" "$VDEV1 log $VDEV2" "$VDEV0 $VDEV1 log $VDEV2"
|
||||
|
||||
+6
@@ -155,6 +155,12 @@ test_replacing_vdevs "raidz $VDEV0 $VDEV1 $VDEV2" \
|
||||
"$VDEV0 $VDEV1 $VDEV2" \
|
||||
true 20
|
||||
|
||||
test_replacing_vdevs "draid:1s $VDEV0 $VDEV1 $VDEV2 $VDEV3 $VDEV4" \
|
||||
"$VDEV1" "$VDEV5" \
|
||||
"draid $VDEV0 $VDEV5 $VDEV2 $VDEV3 $VDEV4 spares draid1-0-0" \
|
||||
"$VDEV0 $VDEV1 $VDEV2 $VDEV3 $VDEV4" \
|
||||
true 30
|
||||
|
||||
set_zfs_txg_timeout $ZFS_TXG_TIMEOUT
|
||||
|
||||
log_pass "zpool import -c cachefile_unaware_of_replace passed."
|
||||
|
||||
+1
@@ -108,6 +108,7 @@ test_shared_device "mirror $VDEV0 $VDEV1" "mirror $VDEV1 $VDEV2" "$VDEV1"
|
||||
test_shared_device "mirror $VDEV0 $VDEV1 $VDEV2" "mirror $VDEV2 $VDEV3" \
|
||||
"$VDEV2"
|
||||
test_shared_device "raidz $VDEV0 $VDEV1 $VDEV2" "$VDEV2" "$VDEV2"
|
||||
test_shared_device "draid $VDEV0 $VDEV1 $VDEV2" "$VDEV2" "$VDEV2"
|
||||
test_shared_device "$VDEV0 log $VDEV1" "$VDEV2 log $VDEV1" "$VDEV1" "-m"
|
||||
|
||||
log_pass "Pool doesn't write to a device it doesn't own anymore."
|
||||
|
||||
@@ -89,9 +89,11 @@ test_new_paths "$VDEV0 $VDEV1" "$VDEV0 $VDEV1"
|
||||
test_new_paths "mirror $VDEV0 $VDEV1" "$VDEV0 $VDEV1"
|
||||
test_new_paths "$VDEV0 log $VDEV1" "$VDEV1"
|
||||
test_new_paths "raidz $VDEV0 $VDEV1 $VDEV2" "$VDEV1"
|
||||
test_new_paths "draid $VDEV0 $VDEV1 $VDEV2" "$VDEV1"
|
||||
|
||||
test_swap_paths "$VDEV0 $VDEV1" "$VDEV0" "$VDEV1"
|
||||
test_swap_paths "raidz $VDEV0 $VDEV1 $VDEV2" "$VDEV0" "$VDEV1"
|
||||
test_swap_paths "draid $VDEV0 $VDEV1 $VDEV2" "$VDEV0" "$VDEV1"
|
||||
test_swap_paths "mirror $VDEV0 $VDEV1 mirror $VDEV2 $VDEV3" \
|
||||
"$VDEV0" "$VDEV2"
|
||||
|
||||
|
||||
+1
@@ -220,6 +220,7 @@ test_add_vdevs "$VDEV0 $VDEV1" "$VDEV2"
|
||||
test_add_vdevs "$VDEV0" "$VDEV1 $VDEV2"
|
||||
test_add_vdevs "mirror $VDEV0 $VDEV1" "mirror $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "raidz $VDEV1 $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "draid $VDEV1 $VDEV2 $VDEV3"
|
||||
test_add_vdevs "$VDEV0" "log $VDEV1"
|
||||
test_add_vdevs "$VDEV0 log $VDEV1" "$VDEV2"
|
||||
|
||||
|
||||
+5
@@ -176,6 +176,11 @@ test_replace_vdev "raidz $VDEV0 $VDEV1 $VDEV2" \
|
||||
"raidz $VDEV0 $VDEV3 $VDEV2" \
|
||||
"$VDEV0 $VDEV1 $VDEV2" 10
|
||||
|
||||
test_replace_vdev "draid $VDEV0 $VDEV1 $VDEV2 $VDEV3" \
|
||||
"$VDEV1" "$VDEV4" \
|
||||
"draid $VDEV0 $VDEV4 $VDEV2 $VDEV3 spares draid1-0-0" \
|
||||
"$VDEV0 $VDEV1 $VDEV2 $VDEV3" 10
|
||||
|
||||
set_zfs_txg_timeout $ZFS_TXG_TIMEOUT
|
||||
|
||||
log_pass "zpool import rewind after device replacement passed."
|
||||
|
||||
@@ -49,7 +49,7 @@ log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
|
||||
|
||||
i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
log_must truncate -s $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export DISK=${DISKS%% *}
|
||||
export FS_SIZE="$((($MINVDEVSIZE / (1024 * 1024)) * 32))m"
|
||||
export FILE_SIZE="$((MINVDEVSIZE))"
|
||||
export SLICE_SIZE="$((($MINVDEVSIZE / (1024 * 1024)) * 2))m"
|
||||
export MAX_NUM=5
|
||||
export MAX_NUM=6
|
||||
export DEVICE_DIR=$TEST_BASE_DIR/dev_import-test
|
||||
export BACKUP_DEVICE_DIR=$TEST_BASE_DIR/bakdev_import-test
|
||||
export DEVICE_FILE=disk
|
||||
@@ -60,5 +60,6 @@ export VDEV1=$DEVICE_DIR/${DEVICE_FILE}1
|
||||
export VDEV2=$DEVICE_DIR/${DEVICE_FILE}2
|
||||
export VDEV3=$DEVICE_DIR/${DEVICE_FILE}3
|
||||
export VDEV4=$DEVICE_DIR/${DEVICE_FILE}4
|
||||
export VDEV5=$DEVICE_DIR/${DEVICE_FILE}5
|
||||
|
||||
export ALTER_ROOT=/alter_import-test
|
||||
|
||||
@@ -31,7 +31,7 @@ function cleanup
|
||||
log_must rm -rf $DEVICE_DIR/*
|
||||
typeset i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
log_must truncate -s $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
((i += 1))
|
||||
done
|
||||
is_linux && set_tunable32 TXG_HISTORY 0
|
||||
@@ -163,7 +163,7 @@ function increase_device_sizes
|
||||
|
||||
typeset -i i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $newfilesize ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
log_must truncate -s $newfilesize ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
((i += 1))
|
||||
done
|
||||
}
|
||||
@@ -171,15 +171,18 @@ function increase_device_sizes
|
||||
#
|
||||
# Translate vdev names returned by zpool status into more generic names.
|
||||
#
|
||||
# eg: mirror-2 --> mirror
|
||||
#
|
||||
function _translate_vdev
|
||||
{
|
||||
typeset vdev=$1
|
||||
|
||||
typeset keywords="mirror replacing raidz1 raidz2 raidz3 indirect"
|
||||
#
|
||||
# eg: mirror-2 --> mirror
|
||||
# eg: draid2:4d:12c:1s-0 --> draid2
|
||||
#
|
||||
typeset keywords="mirror replacing raidz1 raidz2 raidz3 indirect draid1 draid2 draid3"
|
||||
for word in $keywords; do
|
||||
echo $vdev | egrep "^${word}-[0-9]+\$" > /dev/null
|
||||
echo $vdev | egrep -qE \
|
||||
"^${word}-[0-9]+\$|^${word}:[0-9]+d:[0-9]c:[0-9]+s-[0-9]+\$"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
vdev=$word
|
||||
break
|
||||
@@ -188,6 +191,7 @@ function _translate_vdev
|
||||
|
||||
[[ $vdev == "logs" ]] && echo "log" && return 0
|
||||
[[ $vdev == "raidz1" ]] && echo "raidz" && return 0
|
||||
[[ $vdev == "draid1" ]] && echo "draid" && return 0
|
||||
|
||||
echo $vdev
|
||||
return 0
|
||||
|
||||
@@ -63,7 +63,7 @@ log_assert "For raidz, one destroyed pools devices was removed or used by " \
|
||||
"other pool, it still can be imported correctly."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zpool create $TESTPOOL1 raidz $VDEV0 $VDEV1 $VDEV2 $VDIV3
|
||||
log_must zpool create $TESTPOOL1 raidz $VDEV0 $VDEV1 $VDEV2 $VDEV3
|
||||
typeset guid=$(get_config $TESTPOOL1 pool_guid)
|
||||
typeset target=$TESTPOOL1
|
||||
if (( RANDOM % 2 == 0 )) ; then
|
||||
|
||||
@@ -63,7 +63,7 @@ log_assert "For raidz2, two destroyed pools devices was removed or used by " \
|
||||
"other pool, it still can be imported correctly."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zpool create $TESTPOOL1 raidz2 $VDEV0 $VDEV1 $VDEV2 $VDIV3
|
||||
log_must zpool create $TESTPOOL1 raidz2 $VDEV0 $VDEV1 $VDEV2 $VDEV3
|
||||
typeset guid=$(get_config $TESTPOOL1 pool_guid)
|
||||
typeset target=$TESTPOOL1
|
||||
if (( RANDOM % 2 == 0 )) ; then
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
# STRATEGY:
|
||||
# 1. Create a 5 ways mirror pool A with dev0/1/2/3/4, then destroy it.
|
||||
# 2. Create a stripe pool B with dev1. Then destroy it.
|
||||
# 3. Create a raidz2 pool C with dev2/3/4. Then destroy it.
|
||||
# 3. Create a draid2 pool C with dev2/3/4/5. Then destroy it.
|
||||
# 4. Create a raidz pool D with dev3/4. Then destroy it.
|
||||
# 5. Create a stripe pool E with dev4. Then destroy it.
|
||||
# 6. Verify 'zpool import -D -a' recover all the pools.
|
||||
@@ -74,7 +74,7 @@ log_must zpool destroy $poolA
|
||||
log_must zpool create $poolB $VDEV1
|
||||
log_must zpool destroy $poolB
|
||||
|
||||
log_must zpool create $poolC raidz2 $VDEV2 $VDEV3 $VDEV4
|
||||
log_must zpool create $poolC draid2 $VDEV2 $VDEV3 $VDEV4 $VDEV5
|
||||
log_must zpool destroy $poolC
|
||||
|
||||
log_must zpool create $poolD raidz $VDEV3 $VDEV4
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2020 Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# For draid, one destroyed pools devices was removed or used by other
|
||||
# pool, it still can be imported correctly.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a draid pool A with N disks.
|
||||
# 2. Destroy this pool A.
|
||||
# 3. Create another pool B with 1 disk which was used by pool A.
|
||||
# 4. Verify import this draid pool can succeed.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_pool $TESTPOOL2
|
||||
destroy_pool $TESTPOOL1
|
||||
|
||||
log_must rm -rf $DEVICE_DIR/*
|
||||
typeset i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
((i += 1))
|
||||
done
|
||||
}
|
||||
|
||||
log_assert "For draid, one destroyed pools devices was removed or used by " \
|
||||
"other pool, it still can be imported correctly."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zpool create $TESTPOOL1 draid $VDEV0 $VDEV1 $VDEV2 $VDEV3
|
||||
typeset guid=$(get_config $TESTPOOL1 pool_guid)
|
||||
typeset target=$TESTPOOL1
|
||||
if (( RANDOM % 2 == 0 )) ; then
|
||||
target=$guid
|
||||
log_note "Import by guid."
|
||||
fi
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_must zpool create $TESTPOOL2 $VDEV0
|
||||
log_must zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_must zpool destroy $TESTPOOL2
|
||||
log_must rm -rf $VDEV0
|
||||
log_must zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_note "For draid, two destroyed pool's devices were used, import failed."
|
||||
log_must mkfile $FILE_SIZE $VDEV0
|
||||
log_must zpool create $TESTPOOL2 $VDEV0 $VDEV1
|
||||
log_mustnot zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL2
|
||||
|
||||
log_pass "zpool import -D draid passed."
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2020 Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# For draid2, two destroyed pool's devices were removed or used by other
|
||||
# pool, it still can be imported correctly.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a draid2 pool A with N disks.
|
||||
# 2. Destroy this pool A.
|
||||
# 3. Create another pool B with two disks which were used by pool A.
|
||||
# 4. Verify import this draid2 pool can succeed.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_pool $TESTPOOL2
|
||||
destroy_pool $TESTPOOL1
|
||||
|
||||
log_must rm -rf $DEVICE_DIR/*
|
||||
typeset i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
((i += 1))
|
||||
done
|
||||
}
|
||||
|
||||
log_assert "For draid2, two destroyed pools devices was removed or used by " \
|
||||
"other pool, it still can be imported correctly."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zpool create $TESTPOOL1 draid2 $VDEV0 $VDEV1 $VDEV2 $VDEV3
|
||||
typeset guid=$(get_config $TESTPOOL1 pool_guid)
|
||||
typeset target=$TESTPOOL1
|
||||
if (( RANDOM % 2 == 0 )) ; then
|
||||
target=$guid
|
||||
log_note "Import by guid."
|
||||
fi
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_must zpool create $TESTPOOL2 $VDEV0 $VDEV1
|
||||
log_must zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_must zpool destroy $TESTPOOL2
|
||||
log_must rm -rf $VDEV0 $VDEV1
|
||||
log_must zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
|
||||
log_note "For draid2, more than two destroyed pool's devices were used, " \
|
||||
"import failed."
|
||||
log_must mkfile $FILE_SIZE $VDEV0 $VDEV1
|
||||
log_must zpool create $TESTPOOL2 $VDEV0 $VDEV1 $VDEV2
|
||||
log_mustnot zpool import -d $DEVICE_DIR -D -f $target
|
||||
log_must zpool destroy $TESTPOOL2
|
||||
|
||||
log_pass "zpool import -D draid2 passed."
|
||||
+17
-4
@@ -57,8 +57,8 @@
|
||||
# Using the various combinations.
|
||||
# - Regular import
|
||||
# - Alternate Root Specified
|
||||
# It should be succeed with single d/m device upon 'raidz' & 'mirror',
|
||||
# but failed against 'regular' or more d/m devices.
|
||||
# It should succeed with single d/m device upon 'raidz', 'mirror',
|
||||
# 'draid' but failed against 'regular' or more d/m devices.
|
||||
# 6. If import succeed, verify following is true:
|
||||
# - The pool shows up under 'zpool list'.
|
||||
# - The pool's health should be DEGRADED.
|
||||
@@ -67,7 +67,16 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
set -A vdevs "" "mirror" "raidz"
|
||||
# Randomly test a subset of combinations to speed up the test.
|
||||
(( rc=RANDOM % 3 ))
|
||||
if [[ $rc == 0 ]] ; then
|
||||
set -A vdevs "" "mirror" "raidz"
|
||||
elif [[ $rc == 1 ]] ; then
|
||||
set -A vdevs "" "mirror" "draid"
|
||||
else
|
||||
set -A vdevs "" "raidz" "draid"
|
||||
fi
|
||||
|
||||
set -A options "" "-R $ALTER_ROOT"
|
||||
|
||||
function cleanup
|
||||
@@ -89,7 +98,8 @@ function recreate_files
|
||||
log_must rm -rf $DEVICE_DIR/*
|
||||
typeset i=0
|
||||
while (( i < $MAX_NUM )); do
|
||||
log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
log_must rm -f ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
log_must truncate -s $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
((i += 1))
|
||||
done
|
||||
}
|
||||
@@ -157,6 +167,9 @@ while (( i < ${#vdevs[*]} )); do
|
||||
'raidz') (( count > 1 )) && \
|
||||
action=log_mustnot
|
||||
;;
|
||||
'draid') (( count > 1 )) && \
|
||||
action=log_mustnot
|
||||
;;
|
||||
'') action=log_mustnot
|
||||
;;
|
||||
esac
|
||||
|
||||
+20
-3
@@ -43,6 +43,8 @@
|
||||
# before data integrity is compromised
|
||||
# - Raidz could withstand one devices failing
|
||||
# before data integrity is compromised
|
||||
# - dRAID could withstand one devices failing
|
||||
# before data integrity is compromised
|
||||
# Verify that is true.
|
||||
#
|
||||
# STRATEGY:
|
||||
@@ -50,6 +52,7 @@
|
||||
# - Regular pool
|
||||
# - Mirror
|
||||
# - Raidz
|
||||
# - dRAID
|
||||
# 2. Create necessary filesystem and test files.
|
||||
# 3. Export the test pool.
|
||||
# 4. Move one or more device files to other directory
|
||||
@@ -62,7 +65,16 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
set -A vdevs "" "mirror" "raidz"
|
||||
# Randomly test a subset of combinations to speed up the test.
|
||||
(( rc=RANDOM % 3 ))
|
||||
if [[ $rc == 0 ]] ; then
|
||||
set -A vdevs "" "mirror" "raidz"
|
||||
elif [[ $rc == 1 ]] ; then
|
||||
set -A vdevs "" "mirror" "draid"
|
||||
else
|
||||
set -A vdevs "" "raidz" "draid"
|
||||
fi
|
||||
|
||||
set -A options "" "-R $ALTER_ROOT"
|
||||
|
||||
function cleanup
|
||||
@@ -88,7 +100,8 @@ function cleanup_all
|
||||
while (( i < $MAX_NUM )); do
|
||||
typeset dev_file=${DEVICE_DIR}/${DEVICE_FILE}$i
|
||||
if [[ ! -e ${dev_file} ]]; then
|
||||
log_must mkfile $FILE_SIZE ${dev_file}
|
||||
log_must rm -f ${dev_file}
|
||||
log_must truncate -s $FILE_SIZE ${dev_file}
|
||||
fi
|
||||
((i += 1))
|
||||
done
|
||||
@@ -158,7 +171,8 @@ while (( i < ${#vdevs[*]} )); do
|
||||
# Backup all device files while filesystem prepared.
|
||||
#
|
||||
if [[ -z $backup ]] ; then
|
||||
log_must tar cf $DEVICE_DIR/$DEVICE_ARCHIVE ${DEVICE_FILE}*
|
||||
log_must tar cf $DEVICE_DIR/$DEVICE_ARCHIVE \
|
||||
${DEVICE_FILE}0 ${DEVICE_FILE}1 ${DEVICE_FILE}2
|
||||
backup="true"
|
||||
fi
|
||||
|
||||
@@ -174,6 +188,9 @@ while (( i < ${#vdevs[*]} )); do
|
||||
'raidz') (( count == 1 )) && \
|
||||
action=log_must
|
||||
;;
|
||||
'draid') (( count == 1 )) && \
|
||||
action=log_must
|
||||
;;
|
||||
esac
|
||||
|
||||
typeset target=$TESTPOOL1
|
||||
|
||||
+4
-1
@@ -64,7 +64,7 @@ if ! is_illumos; then
|
||||
log_unsupported "Test case may be slow"
|
||||
fi
|
||||
|
||||
set -A vdevs "" "mirror" "raidz"
|
||||
set -A vdevs "" "mirror" "raidz" "draid"
|
||||
|
||||
function verify
|
||||
{
|
||||
@@ -207,6 +207,9 @@ while (( i < ${#vdevs[*]} )); do
|
||||
'raidz') (( overlap > 1 )) && \
|
||||
action=log_mustnot
|
||||
;;
|
||||
'draid') (( overlap > 1 )) && \
|
||||
action=log_mustnot
|
||||
;;
|
||||
'') action=log_mustnot
|
||||
;;
|
||||
esac
|
||||
|
||||
+1
@@ -41,6 +41,7 @@ function cleanup
|
||||
log_must zpool detach $TESTPOOL $DISK2
|
||||
get_disklist $TESTPOOL | grep $DISK3 >/dev/null && \
|
||||
log_must zpool detach $TESTPOOL $DISK3
|
||||
log_must zpool sync $TESTPOOL
|
||||
}
|
||||
|
||||
typeset pid
|
||||
|
||||
@@ -54,7 +54,7 @@ if is_linux; then
|
||||
# Add one 512b scsi_debug device (4Kn would generate IO errors)
|
||||
# NOTE: must be larger than other "file" vdevs and minimum SPA devsize:
|
||||
# add 32m of fudge
|
||||
load_scsi_debug $(($SPA_MINDEVSIZE/1024/1024+32)) 1 1 1 '512b'
|
||||
load_scsi_debug $(($MINVDEVSIZE/1024/1024+32)) 1 1 1 '512b'
|
||||
else
|
||||
log_unsupported "scsi debug module unsupported"
|
||||
fi
|
||||
@@ -85,10 +85,10 @@ typeset poolconfs=(
|
||||
"mirror $filedev1 $filedev2 special mirror $filedev3 $removedev"
|
||||
)
|
||||
|
||||
log_must truncate -s $SPA_MINDEVSIZE $filedev1
|
||||
log_must truncate -s $SPA_MINDEVSIZE $filedev2
|
||||
log_must truncate -s $SPA_MINDEVSIZE $filedev3
|
||||
log_must truncate -s $SPA_MINDEVSIZE $sparedev
|
||||
log_must truncate -s $MINVDEVSIZE $filedev1
|
||||
log_must truncate -s $MINVDEVSIZE $filedev2
|
||||
log_must truncate -s $MINVDEVSIZE $filedev3
|
||||
log_must truncate -s $MINVDEVSIZE $sparedev
|
||||
|
||||
for conf in "${poolconfs[@]}"
|
||||
do
|
||||
|
||||
@@ -55,36 +55,59 @@ zed_events_drain
|
||||
|
||||
TESTFILE="/$TESTPOOL/$TESTFS/testfile"
|
||||
|
||||
for type in "mirror" "raidz" "raidz2"; do
|
||||
# 1. Create a pool with hot spares
|
||||
truncate -s $SPA_MINDEVSIZE $VDEV_FILES $SPARE_FILE
|
||||
log_must zpool create -f $TESTPOOL $type $VDEV_FILES spare $SPARE_FILE
|
||||
for type in "mirror" "raidz" "raidz2" "draid:1s"; do
|
||||
if [ "$type" = "draid:1s" ]; then
|
||||
# 1. Create a dRAID pool with a distributed hot spare
|
||||
#
|
||||
# Corruption is injected in the file-2 instead of file-1
|
||||
# vdev since the dRAID permutation at these offsets maps
|
||||
# to distributed spare space and not data devices.
|
||||
#
|
||||
log_must truncate -s $MINVDEVSIZE $VDEV_FILES
|
||||
log_must zpool create -f $TESTPOOL $type $VDEV_FILES
|
||||
SPARE="draid1-0-0"
|
||||
FAULT="$TEST_BASE_DIR/file-2"
|
||||
else
|
||||
# 1. Create a pool with hot spares
|
||||
log_must truncate -s $MINVDEVSIZE $VDEV_FILES $SPARE_FILE
|
||||
log_must zpool create -f $TESTPOOL $type $VDEV_FILES \
|
||||
spare $SPARE_FILE
|
||||
SPARE=$SPARE_FILE
|
||||
FAULT=$FAULT_FILE
|
||||
fi
|
||||
|
||||
# 2. Create a filesystem with the primary cache disable to force reads
|
||||
log_must zfs create -o primarycache=none $TESTPOOL/$TESTFS
|
||||
log_must zfs set recordsize=16k $TESTPOOL/$TESTFS
|
||||
|
||||
# 3. Write a file to the pool to be read back
|
||||
log_must dd if=/dev/urandom of=$TESTFILE bs=1M count=16
|
||||
log_must dd if=/dev/urandom of=$TESTFILE bs=1M count=64
|
||||
|
||||
# 4. Inject IO ERRORS on read with a zinject error handler
|
||||
log_must zinject -d $FAULT_FILE -e io -T read $TESTPOOL
|
||||
log_must zinject -d $FAULT -e io -T read $TESTPOOL
|
||||
log_must cp $TESTFILE /dev/null
|
||||
|
||||
# 5. Verify the ZED kicks in a hot spare and expected pool/device status
|
||||
log_note "Wait for ZED to auto-spare"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_FILE "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE_FILE "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_FILE "INUSE"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE "INUSE"
|
||||
log_must check_state $TESTPOOL "" "DEGRADED"
|
||||
|
||||
# The ZED will use a sequential resilver for dRAID. Wait for the
|
||||
# resilver and subsequent scrub to complete before moving on.
|
||||
if [ "$type" = "draid:1s" ]; then
|
||||
log_must wait_scrubbed $TESTPOOL
|
||||
fi
|
||||
|
||||
# 6. Clear the fault
|
||||
log_must zinject -c all
|
||||
log_must zpool clear $TESTPOOL $FAULT_FILE
|
||||
log_must zpool clear $TESTPOOL $FAULT
|
||||
|
||||
# 7. Verify the hot spare is available and expected pool/device status
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_FILE "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_FILE "AVAIL"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE "AVAIL"
|
||||
|
||||
log_must is_pool_resilvered $TESTPOOL
|
||||
log_must check_state $TESTPOOL "" "ONLINE"
|
||||
|
||||
|
||||
@@ -60,15 +60,16 @@ TESTFILE="/$TESTPOOL/$TESTFS/testfile"
|
||||
|
||||
for type in "mirror" "raidz" "raidz2"; do
|
||||
# 1. Create a pool with hot spares
|
||||
truncate -s $SPA_MINDEVSIZE $VDEV_FILES $SPARE_FILE
|
||||
log_must zpool create -f $TESTPOOL $type $VDEV_FILES spare $SPARE_FILE
|
||||
log_must truncate -s $MINVDEVSIZE $VDEV_FILES $SPARE_FILE
|
||||
log_must zpool create -f $TESTPOOL $type $VDEV_FILES \
|
||||
spare $SPARE_FILE
|
||||
|
||||
# 2. Create a filesystem with the primary cache disable to force reads
|
||||
log_must zfs create -o primarycache=none $TESTPOOL/$TESTFS
|
||||
log_must zfs set recordsize=16k $TESTPOOL/$TESTFS
|
||||
|
||||
# 3. Write a file to the pool to be read back
|
||||
log_must dd if=/dev/urandom of=$TESTFILE bs=1M count=16
|
||||
log_must dd if=/dev/urandom of=$TESTFILE bs=1M count=64
|
||||
|
||||
# 4. Inject CHECKSUM ERRORS on read with a zinject error handler
|
||||
log_must zinject -d $FAULT_FILE -e corrupt -f 50 -T read $TESTPOOL
|
||||
|
||||
@@ -60,7 +60,7 @@ FAIL_DEVICE="$TEST_BASE_DIR/fail-dev"
|
||||
|
||||
# 1. Create a pool from 512b devices and set "ashift" pool property accordingly
|
||||
for vdev in $SAFE_DEVICE $FAIL_DEVICE; do
|
||||
truncate -s $SPA_MINDEVSIZE $vdev
|
||||
truncate -s $MINVDEVSIZE $vdev
|
||||
done
|
||||
log_must zpool create -f $TESTPOOL mirror $SAFE_DEVICE $FAIL_DEVICE
|
||||
# NOTE: file VDEVs should be added as 512b devices, verify this "just in case"
|
||||
@@ -71,7 +71,7 @@ log_must zpool set ashift=9 $TESTPOOL
|
||||
|
||||
# 2. Add one 512e spare device (4Kn would generate IO errors on replace)
|
||||
# NOTE: must be larger than the existing 512b devices, add 32m of fudge
|
||||
load_scsi_debug $(($SPA_MINDEVSIZE/1024/1024+32)) $SDHOSTS $SDTGTS $SDLUNS '512e'
|
||||
load_scsi_debug $(($MINVDEVSIZE/1024/1024+32)) $SDHOSTS $SDTGTS $SDLUNS '512e'
|
||||
SPARE_DEVICE=$(get_debug_device)
|
||||
log_must_busy zpool add $TESTPOOL spare $SPARE_DEVICE
|
||||
|
||||
|
||||
@@ -63,15 +63,43 @@ FAULT_DEV1="$TEST_BASE_DIR/fault-dev1"
|
||||
FAULT_DEV2="$TEST_BASE_DIR/fault-dev2"
|
||||
SAFE_DEV1="$TEST_BASE_DIR/safe-dev1"
|
||||
SAFE_DEV2="$TEST_BASE_DIR/safe-dev2"
|
||||
DATA_DEVS="$FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV1 $SAFE_DEV2"
|
||||
SAFE_DEV3="$TEST_BASE_DIR/safe-dev3"
|
||||
SAFE_DEV4="$TEST_BASE_DIR/safe-dev4"
|
||||
DATA_DEVS="$FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV1 $SAFE_DEV2 $SAFE_DEV3 $SAFE_DEV4"
|
||||
SPARE_DEV1="$TEST_BASE_DIR/spare-dev1"
|
||||
SPARE_DEV2="$TEST_BASE_DIR/spare-dev2"
|
||||
SPARE_DEVS="$SPARE_DEV1 $SPARE_DEV2"
|
||||
|
||||
for type in "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
# 1. Create a pool with two hot spares
|
||||
truncate -s $SPA_MINDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type $DATA_DEVS spare $SPARE_DEVS
|
||||
for type in "mirror" "raidz" "raidz2" "raidz3" "draid2:1s"; do
|
||||
if [ "$type" = "draid2:1s" ]; then
|
||||
# 1. Create a dRAID pool with a distributed and traditional
|
||||
# hot spare to provide test coverage for both configurations.
|
||||
#
|
||||
# Corruption is injected in the third and fourth vdevs
|
||||
# since the dRAID permutation at these offsets maps to
|
||||
# distributed spare space and not data devices.
|
||||
#
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEV1
|
||||
log_must zpool create -f $TESTPOOL $type $SAFE_DEV1 \
|
||||
$SAFE_DEV2 $FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV3 $SAFE_DEV4 \
|
||||
spare $SPARE_DEV1
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2="draid2-0-0"
|
||||
elif [ "$type" = "mirror" ]; then
|
||||
# 1. Create a 3-way mirror pool with two hot spares
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type \
|
||||
$FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV1 spare $SPARE_DEVS
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2=$SPARE_DEV2
|
||||
else
|
||||
# 1. Create a raidz pool with two hot spares
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type $DATA_DEVS \
|
||||
spare $SPARE_DEVS
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2=$SPARE_DEV2
|
||||
fi
|
||||
|
||||
# 2. Inject IO ERRORS with a zinject error handler on the first device
|
||||
log_must zinject -d $FAULT_DEV1 -e io -T all -f 100 $TESTPOOL
|
||||
@@ -79,11 +107,11 @@ for type in "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
# 3. Start a scrub
|
||||
log_must zpool scrub $TESTPOOL
|
||||
|
||||
# 4. Verify the ZED kicks in a hot spare and expected pool/device status
|
||||
# 4. Verify the ZED kicks in a hot spare and the pool/device status
|
||||
log_note "Wait for ZED to auto-spare"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV1 "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE_DEV1 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV1 "INUSE"
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE1 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE1 "INUSE"
|
||||
log_must check_state $TESTPOOL "" "DEGRADED"
|
||||
|
||||
# 5. Inject IO ERRORS on a second device
|
||||
@@ -98,10 +126,14 @@ for type in "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
# 7. Verify the ZED kicks in a second hot spare
|
||||
log_note "Wait for ZED to auto-spare"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV2 "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE_DEV2 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV2 "INUSE"
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE2 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE2 "INUSE"
|
||||
log_must check_state $TESTPOOL "" "DEGRADED"
|
||||
|
||||
while is_pool_scrubbing $TESTPOOL || is_pool_resilvering $TESTPOOL; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 8. Clear the fault on both devices
|
||||
log_must zinject -c all
|
||||
log_must zpool clear $TESTPOOL $FAULT_DEV1
|
||||
@@ -110,8 +142,8 @@ for type in "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
# 9. Verify the hot spares are available and expected pool/device status
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV1 "ONLINE" 60
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV2 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV1 "AVAIL"
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV2 "AVAIL"
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE1 "AVAIL"
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE2 "AVAIL"
|
||||
log_must check_state $TESTPOOL "" "ONLINE"
|
||||
|
||||
# Cleanup
|
||||
@@ -120,11 +152,37 @@ done
|
||||
|
||||
# Rinse and repeat, this time faulting both devices at the same time
|
||||
# NOTE: "raidz" is excluded since it cannot survive 2 faulted devices
|
||||
# NOTE: "mirror" is a 4-way mirror here and should survive this test
|
||||
for type in "mirror" "raidz2" "raidz3"; do
|
||||
# 1. Create a pool with two hot spares
|
||||
truncate -s $SPA_MINDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type $DATA_DEVS spare $SPARE_DEVS
|
||||
# NOTE: "mirror" is a 3-way mirror here and should survive this test
|
||||
for type in "mirror" "raidz2" "raidz3" "draid2:1s"; do
|
||||
if [ "$type" = "draid2:1s" ]; then
|
||||
# 1. Create a dRAID pool with a distributed and traditional
|
||||
# hot spare to provide test coverage for both configurations.
|
||||
#
|
||||
# Corruption is injected in the third and fourth vdevs
|
||||
# since the dRAID permutation at these offsets maps to
|
||||
# distributed spare space and not data devices.
|
||||
#
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEV1
|
||||
log_must zpool create -f $TESTPOOL $type $SAFE_DEV1 \
|
||||
$SAFE_DEV2 $FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV3 $SAFE_DEV4 \
|
||||
spare $SPARE_DEV1
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2="draid2-0-0"
|
||||
elif [ "$type" = "mirror" ]; then
|
||||
# 1. Create a 3-way mirror pool with two hot spares
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type \
|
||||
$FAULT_DEV1 $FAULT_DEV2 $SAFE_DEV1 spare $SPARE_DEVS
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2=$SPARE_DEV2
|
||||
else
|
||||
# 1. Create a raidz pool with two hot spares
|
||||
truncate -s $MINVDEVSIZE $DATA_DEVS $SPARE_DEVS
|
||||
log_must zpool create -f $TESTPOOL $type $DATA_DEVS \
|
||||
spare $SPARE_DEVS
|
||||
SPARE1=$SPARE_DEV1
|
||||
SPARE2=$SPARE_DEV2
|
||||
fi
|
||||
|
||||
# 2. Inject IO ERRORS with a zinject error handler on two devices
|
||||
log_must eval "zinject -d $FAULT_DEV1 -e io -T all -f 100 $TESTPOOL &"
|
||||
@@ -133,14 +191,14 @@ for type in "mirror" "raidz2" "raidz3"; do
|
||||
# 3. Start a scrub
|
||||
log_must zpool scrub $TESTPOOL
|
||||
|
||||
# 4. Verify the ZED kicks in two hot spares and expected pool/device status
|
||||
# 4. Verify the ZED kicks in two hot spares and the pool/device status
|
||||
log_note "Wait for ZED to auto-spare"
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV1 "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $FAULT_DEV2 "FAULTED" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE_DEV1 "ONLINE" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE_DEV2 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV1 "INUSE"
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE_DEV2 "INUSE"
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE1 "ONLINE" 60
|
||||
log_must wait_vdev_state $TESTPOOL $SPARE2 "ONLINE" 60
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE1 "INUSE"
|
||||
log_must wait_hotspare_state $TESTPOOL $SPARE2 "INUSE"
|
||||
log_must check_state $TESTPOOL "" "DEGRADED"
|
||||
|
||||
# 5. Clear the fault on both devices
|
||||
|
||||
@@ -42,7 +42,7 @@ if is_linux; then
|
||||
# Add one 512b spare device (4Kn would generate IO errors on replace)
|
||||
# NOTE: must be larger than other "file" vdevs and minimum SPA devsize:
|
||||
# add 32m of fudge
|
||||
load_scsi_debug $(($SPA_MINDEVSIZE/1024/1024+32)) 1 1 1 '512b'
|
||||
load_scsi_debug $(($MINVDEVSIZE/1024/1024+32)) 1 1 1 '512b'
|
||||
else
|
||||
log_unsupported "scsi debug module unsupported"
|
||||
fi
|
||||
@@ -72,7 +72,7 @@ SPARE_DISKDEV="$(get_debug_device)"
|
||||
|
||||
for vdev in $SAFE_FILEDEVPOOL1 $SAFE_FILEDEVPOOL2 $FAIL_FILEDEVPOOL1 \
|
||||
$FAIL_FILEDEVPOOL2 $SPARE_FILEDEV; do
|
||||
log_must truncate -s $SPA_MINDEVSIZE $vdev
|
||||
log_must truncate -s $MINVDEVSIZE $vdev
|
||||
done
|
||||
|
||||
for spare in $SPARE_FILEDEV $SPARE_DISKDEV; do
|
||||
|
||||
@@ -3,4 +3,6 @@ dist_pkgdata_SCRIPTS = \
|
||||
setup.ksh \
|
||||
cleanup.ksh \
|
||||
raidz_001_neg.ksh \
|
||||
raidz_002_pos.ksh
|
||||
raidz_002_pos.ksh \
|
||||
raidz_003_pos.ksh \
|
||||
raidz_004_pos.ksh
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 by vStack. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Call the raidz_test tool with -S and -e to test all supported raidz
|
||||
# implementations with expanded map and default reflow offset.
|
||||
# This options will test several raidz block geometries and several zio
|
||||
# parameters that affect raidz block layout. Data reconstruction performs
|
||||
# all combinations of failed disks. Wall time is set to 5min, but actual
|
||||
# runtime might be longer.
|
||||
#
|
||||
|
||||
log_must raidz_test -S -e -t 60
|
||||
|
||||
log_pass "raidz_test parameter sweep test with expanded map succeeded."
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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) 2020 by vStack. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Call the raidz_test tool with -S and -e to test all supported raidz
|
||||
# implementations with expanded map and zero reflow offset.
|
||||
# This options will test several raidz block geometries and several zio
|
||||
# parameters that affect raidz block layout. Data reconstruction performs
|
||||
# all combinations of failed disks. Wall time is set to 5min, but actual
|
||||
# runtime might be longer.
|
||||
#
|
||||
|
||||
log_must raidz_test -S -e -r 0 -t 60
|
||||
|
||||
log_pass "raidz_test parameter sweep test with expanded map succeeded."
|
||||
@@ -2,10 +2,17 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/redundancy
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
setup.ksh \
|
||||
cleanup.ksh \
|
||||
redundancy_001_pos.ksh \
|
||||
redundancy_002_pos.ksh \
|
||||
redundancy_003_pos.ksh \
|
||||
redundancy_004_neg.ksh
|
||||
redundancy_draid1.ksh \
|
||||
redundancy_draid2.ksh \
|
||||
redundancy_draid3.ksh \
|
||||
redundancy_draid_spare1.ksh \
|
||||
redundancy_draid_spare2.ksh \
|
||||
redundancy_draid_spare3.ksh \
|
||||
redundancy_mirror.ksh \
|
||||
redundancy_raidz1.ksh \
|
||||
redundancy_raidz2.ksh \
|
||||
redundancy_raidz3.ksh \
|
||||
redundancy_stripe.ksh
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
redundancy.cfg \
|
||||
|
||||
@@ -66,6 +66,23 @@ function random
|
||||
echo $value
|
||||
}
|
||||
|
||||
#
|
||||
# Get the number of checksum errors for the pool.
|
||||
#
|
||||
# $1 Pool
|
||||
#
|
||||
function cksum_pool
|
||||
{
|
||||
typeset -i cksum=$(zpool status $1 | awk '
|
||||
!NF { isvdev = 0 }
|
||||
isvdev { errors += $NF }
|
||||
/CKSUM$/ { isvdev = 1 }
|
||||
END { print errors }
|
||||
')
|
||||
|
||||
echo $cksum
|
||||
}
|
||||
|
||||
#
|
||||
# Record the directories construction and checksum all the files which reside
|
||||
# within the specified pool
|
||||
@@ -81,6 +98,7 @@ function record_data
|
||||
[[ -z $pool ]] && log_fail "No specified pool."
|
||||
[[ -f $recordfile ]] && log_must rm -f $recordfile
|
||||
|
||||
sync_pool $pool
|
||||
typeset mntpnt
|
||||
mntpnt=$(get_prop mountpoint $pool)
|
||||
log_must eval "du -a $mntpnt > $recordfile 2>&1"
|
||||
@@ -119,22 +137,43 @@ function setup_test_env
|
||||
destroy_pool $pool
|
||||
fi
|
||||
|
||||
log_must mkfile $MINVDEVSIZE $vdevs
|
||||
log_must truncate -s $MINVDEVSIZE $vdevs
|
||||
|
||||
log_must zpool create -m $TESTDIR $pool $keyword $vdevs
|
||||
log_must zpool create -f -m $TESTDIR $pool $keyword $vdevs
|
||||
|
||||
log_note "Filling up the filesystem ..."
|
||||
typeset -i ret=0
|
||||
typeset -i i=0
|
||||
typeset file=$TESTDIR/file
|
||||
typeset -i limit
|
||||
(( limit = $(get_prop available $pool) / 4 ))
|
||||
|
||||
while true ; do
|
||||
file_write -o create -f $file.$i \
|
||||
-b $BLOCKSZ -c $NUM_WRITES
|
||||
[[ $(get_prop available $pool) -lt $limit ]] && break
|
||||
file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES
|
||||
ret=$?
|
||||
(( $ret != 0 )) && break
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
|
||||
record_data $TESTPOOL $PRE_RECORD_FILE
|
||||
}
|
||||
|
||||
function refill_test_env
|
||||
{
|
||||
log_note "Re-filling the filesystem ..."
|
||||
typeset -i ret=0
|
||||
typeset -i i=0
|
||||
typeset mntpnt
|
||||
mntpnt=$(get_prop mountpoint $pool)
|
||||
typeset file=$mntpnt/file
|
||||
while [[ -e $file.$i ]]; do
|
||||
log_must rm -f $file.$i
|
||||
file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES
|
||||
ret=$?
|
||||
(( $ret != 0 )) && break
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
(($ret != 28 )) && log_note "file_write return value($ret) is unexpected."
|
||||
|
||||
record_data $TESTPOOL $PRE_RECORD_FILE
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# A draid pool can withstand at most 1 device failing or missing.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create N(>3,<6) virtual disk files.
|
||||
# 2. Create draid pool based on the virtual disk files.
|
||||
# 3. Fill the filesystem with directories and files.
|
||||
# 4. Record all the files and directories checksum information.
|
||||
# 5. Damaged one of the virtual disk file.
|
||||
# 6. Verify the data is correct to prove draid can withstand 1 device is
|
||||
# failing.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify draid pool can withstand one device failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 3 6)
|
||||
setup_test_env $TESTPOOL draid $cnt
|
||||
|
||||
#
|
||||
# Inject data corruption error for draid pool
|
||||
#
|
||||
damage_devs $TESTPOOL 1 "label"
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must clear_errors $TESTPOOL
|
||||
|
||||
#
|
||||
# Inject bad device error for draid pool
|
||||
#
|
||||
damage_devs $TESTPOOL 1
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL 1
|
||||
|
||||
#
|
||||
# Inject missing device error for draid pool
|
||||
#
|
||||
remove_devs $TESTPOOL 1
|
||||
log_must is_data_valid $TESTPOOL
|
||||
|
||||
log_pass "draid pool can withstand one device failing passed."
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# A draid2 pool can withstand 2 devices are failing or missing.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create N(>4,<6) virtual disk files.
|
||||
# 2. Create draid2 pool based on the virtual disk files.
|
||||
# 3. Fill the filesystem with directories and files.
|
||||
# 4. Record all the files and directories checksum information.
|
||||
# 5. Damaged at most two of the virtual disk files.
|
||||
# 6. Verify the data is correct to prove draid2 can withstand 2 devices
|
||||
# are failing.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify draid2 pool can withstand two devices failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 4 6)
|
||||
setup_test_env $TESTPOOL draid2 $cnt
|
||||
|
||||
#
|
||||
# Inject data corruption errors for draid2 pool
|
||||
#
|
||||
for i in 1 2; do
|
||||
damage_devs $TESTPOOL $i "label"
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must clear_errors $TESTPOOL
|
||||
done
|
||||
|
||||
#
|
||||
# Inject bad devices errors for draid2 pool
|
||||
#
|
||||
for i in 1 2; do
|
||||
damage_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
#
|
||||
# Inject missing device errors for draid2 pool
|
||||
#
|
||||
for i in 1 2; do
|
||||
remove_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
log_pass "draid2 pool can withstand two devices failing passed."
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# A draid3 pool can withstand 3 devices are failing or missing.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create N(>5,<6) virtual disk files.
|
||||
# 2. Create draid3 pool based on the virtual disk files.
|
||||
# 3. Fill the filesystem with directories and files.
|
||||
# 4. Record all the files and directories checksum information.
|
||||
# 5. Damaged at most two of the virtual disk files.
|
||||
# 6. Verify the data is correct to prove draid3 can withstand 3 devices
|
||||
# are failing.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify draid3 pool can withstand three devices failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 5 6)
|
||||
setup_test_env $TESTPOOL draid3 $cnt
|
||||
|
||||
#
|
||||
# Inject data corruption errors for draid3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
damage_devs $TESTPOOL $i "label"
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must clear_errors $TESTPOOL
|
||||
done
|
||||
|
||||
#
|
||||
# Inject bad devices errors for draid3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
damage_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
#
|
||||
# Inject missing device errors for draid3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
remove_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
log_pass "draid3 pool can withstand three devices failing passed."
|
||||
@@ -0,0 +1,107 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2019, Datto Inc. All rights reserved.
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify resilver to dRAID distributed spares.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. For resilvers:
|
||||
# a. Create a semi-random dRAID pool configuration which can:
|
||||
# - sustain N failures (1-3), and
|
||||
# - has N distributed spares to replace all faulted vdevs
|
||||
# b. Fill the pool with data
|
||||
# c. Systematically fault a vdev, then replace it with a spare
|
||||
# d. Scrub the pool to verify no data was lost
|
||||
# e. Verify the contents of files in the pool
|
||||
#
|
||||
|
||||
log_assert "Verify resilver to dRAID distributed spares"
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
for replace_mode in "healing" "sequential"; do
|
||||
|
||||
if [[ "$replace_mode" = "sequential" ]]; then
|
||||
flags="-s"
|
||||
else
|
||||
flags=""
|
||||
fi
|
||||
|
||||
parity=$(random_int_between 1 3)
|
||||
spares=$(random_int_between $parity 3)
|
||||
data=$(random_int_between 1 8)
|
||||
|
||||
(( min_children = (data + parity + spares) ))
|
||||
children=$(random_int_between $min_children 16)
|
||||
|
||||
draid="draid${parity}:${data}d:${children}c:${spares}s"
|
||||
|
||||
setup_test_env $TESTPOOL $draid $children
|
||||
|
||||
i=0
|
||||
while [[ $i -lt $spares ]]; do
|
||||
fault_vdev="$BASEDIR/vdev$i"
|
||||
spare_vdev="draid${parity}-0-${i}"
|
||||
|
||||
log_must zpool offline -f $TESTPOOL $fault_vdev
|
||||
log_must check_vdev_state $TESTPOOL $fault_vdev "FAULTED"
|
||||
log_must zpool replace -w $flags $TESTPOOL \
|
||||
$fault_vdev $spare_vdev
|
||||
log_must check_vdev_state spare-$i "DEGRADED"
|
||||
log_must check_vdev_state $spare_vdev "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL $spare_vdev "INUSE"
|
||||
log_must zpool detach $TESTPOOL $fault_vdev
|
||||
|
||||
resilver_cksum=$(cksum_pool $TESTPOOL)
|
||||
if [[ $resilver_cksum != 0 ]]; then
|
||||
log_must zpool status -v $TESTPOOL
|
||||
log_fail "$replace_mode resilver "
|
||||
"cksum errors: $resilver_cksum"
|
||||
fi
|
||||
|
||||
if [[ "$replace_mode" = "healing" ]]; then
|
||||
log_must zpool scrub $TESTPOOL
|
||||
fi
|
||||
|
||||
log_must wait_scrubbed $TESTPOOL
|
||||
log_must check_pool_status $TESTPOOL "scan" "repaired 0B"
|
||||
log_must check_pool_status $TESTPOOL "scan" "with 0 errors"
|
||||
|
||||
scrub_cksum=$(cksum_pool $TESTPOOL)
|
||||
if [[ $scrub_cksum != 0 ]]; then
|
||||
log_must zpool status -v $TESTPOOL
|
||||
log_fail "scrub cksum errors: $scrub_cksum"
|
||||
fi
|
||||
|
||||
(( i += 1 ))
|
||||
done
|
||||
|
||||
log_must is_data_valid $TESTPOOL
|
||||
|
||||
cleanup
|
||||
done
|
||||
|
||||
log_pass "Verify resilver to dRAID distributed spares"
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify multiple dRAID spares can be used.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a pool and fill it with data.
|
||||
# 2. Engage 3 distributed spares and verify the pool
|
||||
# 3. Refill the filesystem with new data
|
||||
# 4. Clear the pool to online previous faulted devices and resilver
|
||||
# 5. Verify the pool and its contents
|
||||
#
|
||||
|
||||
log_assert "Verify multiple dRAID spares"
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
parity=1
|
||||
spares=3
|
||||
data=$(random_int_between 1 4)
|
||||
children=10
|
||||
draid="draid${parity}:${data}d:${children}c:${spares}s"
|
||||
|
||||
setup_test_env $TESTPOOL $draid $children
|
||||
|
||||
# Replace vdev7 -> draid1-0-0
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev7
|
||||
log_must zpool replace -w $TESTPOOL $BASEDIR/vdev7 draid1-0-0
|
||||
|
||||
# Replace vdev8 -> draid1-0-1
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev8
|
||||
log_must zpool replace -w $TESTPOOL $BASEDIR/vdev8 draid1-0-1
|
||||
|
||||
# Replace vdev9 -> draid1-0-2
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev9
|
||||
log_must zpool replace -w $TESTPOOL $BASEDIR/vdev9 draid1-0-2
|
||||
|
||||
# Verify, refill and verify the pool contents.
|
||||
verify_pool $TESTPOOL
|
||||
refill_test_env $TESTPOOL
|
||||
verify_pool $TESTPOOL
|
||||
|
||||
# Bring everything back online and check for errors.
|
||||
log_must zpool clear $TESTPOOL
|
||||
log_must zpool wait -t resilver $TESTPOOL
|
||||
|
||||
log_must wait_hotspare_state $TESTPOOL draid1-0-0 "AVAIL"
|
||||
log_must wait_hotspare_state $TESTPOOL draid1-0-1 "AVAIL"
|
||||
log_must wait_hotspare_state $TESTPOOL draid1-0-2 "AVAIL"
|
||||
|
||||
log_must zpool scrub -w $TESTPOOL
|
||||
log_must check_pool_status $TESTPOOL "scan" "repaired 0B"
|
||||
log_must check_pool_status $TESTPOOL "scan" "with 0 errors"
|
||||
|
||||
log_must is_data_valid $TESTPOOL
|
||||
|
||||
log_pass "Verify multiple dRAID spares"
|
||||
@@ -0,0 +1,197 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify dRAID resilver to traditional and distributed spares for
|
||||
# a variety of pool configurations and pool states.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. For resilvers:
|
||||
# a. Create a semi-random dRAID pool configuration which can
|
||||
# sustain 1 failure and has 5 distributed spares.
|
||||
# b. Fill the pool with data
|
||||
# c. Systematically fault and replace vdevs in the pools with
|
||||
# spares to test resilving in common pool states.
|
||||
# d. Scrub the pool to verify no data was lost
|
||||
# e. Verify the contents of files in the pool
|
||||
#
|
||||
|
||||
log_assert "Verify dRAID resilver"
|
||||
|
||||
function cleanup_tunable
|
||||
{
|
||||
log_must set_tunable32 REBUILD_SCRUB_ENABLED 1
|
||||
cleanup
|
||||
}
|
||||
|
||||
log_onexit cleanup_tunable
|
||||
|
||||
if is_kmemleak; then
|
||||
log_unsupported "Test case runs slowly when kmemleak is enabled"
|
||||
fi
|
||||
|
||||
#
|
||||
# Disable scrubbing after a sequential resilver to verify the resilver
|
||||
# alone is able to reconstruct the data without the help of a scrub.
|
||||
#
|
||||
log_must set_tunable32 REBUILD_SCRUB_ENABLED 0
|
||||
|
||||
for replace_mode in "healing" "sequential"; do
|
||||
|
||||
if [[ "$replace_mode" = "sequential" ]]; then
|
||||
flags="-s"
|
||||
else
|
||||
flags=""
|
||||
fi
|
||||
|
||||
parity=1
|
||||
spares=5
|
||||
data=$(random_int_between 1 4)
|
||||
children=10
|
||||
draid="draid${parity}:${data}d:${children}c:${spares}s"
|
||||
|
||||
setup_test_env $TESTPOOL $draid $children
|
||||
|
||||
#
|
||||
# Perform a variety of replacements to normal and distributed spares
|
||||
# for a variety of different vdev configurations to exercise different
|
||||
# resilver code paths. The final configuration is expected to be:
|
||||
#
|
||||
# NAME STATE READ WRITE CKSUM
|
||||
# testpool DEGRADED 0 0 0
|
||||
# draid1:1d:10c:5s-0 DEGRADED 0 0 0
|
||||
# /var/tmp/basedir.28683/new_vdev0 ONLINE 0 0 0
|
||||
# /var/tmp/basedir.28683/new_vdev1 ONLINE 0 0 0
|
||||
# spare-2 DEGRADED 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev2 FAULTED 0 0 0
|
||||
# draid1-0-3 ONLINE 0 0 0
|
||||
# spare-3 DEGRADED 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev3 FAULTED 0 0 0
|
||||
# draid1-0-4 ONLINE 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev4 ONLINE 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev5 ONLINE 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev6 ONLINE 0 0 0
|
||||
# draid1-0-0 ONLINE 0 0 0
|
||||
# spare-8 DEGRADED 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev8 FAULTED 0 0 0
|
||||
# draid1-0-1 ONLINE 0 0 0
|
||||
# spare-9 ONLINE 0 0 0
|
||||
# /var/tmp/basedir.28683/vdev9 ONLINE 0 0 0
|
||||
# draid1-0-2 ONLINE 0 0 0
|
||||
# spares
|
||||
# draid1-0-0 INUSE currently in use
|
||||
# draid1-0-1 INUSE currently in use
|
||||
# draid1-0-2 INUSE currently in use
|
||||
# draid1-0-3 INUSE currently in use
|
||||
# draid1-0-4 INUSE currently in use
|
||||
#
|
||||
|
||||
# Distributed spare which replaces original online device
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev7 "ONLINE"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev7 draid1-0-0
|
||||
log_must zpool detach $TESTPOOL $BASEDIR/vdev7
|
||||
log_must check_vdev_state $TESTPOOL draid1-0-0 "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL draid1-0-0 "INUSE"
|
||||
|
||||
# Distributed spare in mirror with original device faulted
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev8
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev8 "FAULTED"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev8 draid1-0-1
|
||||
log_must check_vdev_state $TESTPOOL spare-8 "DEGRADED"
|
||||
log_must check_vdev_state $TESTPOOL draid1-0-1 "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL draid1-0-1 "INUSE"
|
||||
|
||||
# Distributed spare in mirror with original device still online
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev9 "ONLINE"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev9 draid1-0-2
|
||||
log_must check_vdev_state $TESTPOOL spare-9 "ONLINE"
|
||||
log_must check_vdev_state $TESTPOOL draid1-0-2 "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL draid1-0-2 "INUSE"
|
||||
|
||||
# Normal faulted device replacement
|
||||
new_vdev0="$BASEDIR/new_vdev0"
|
||||
log_must truncate -s $MINVDEVSIZE $new_vdev0
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev0
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev0 "FAULTED"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev0 $new_vdev0
|
||||
log_must check_vdev_state $TESTPOOL $new_vdev0 "ONLINE"
|
||||
|
||||
# Distributed spare faulted device replacement
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev2
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev2 "FAULTED"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev2 draid1-0-3
|
||||
log_must check_vdev_state $TESTPOOL spare-2 "DEGRADED"
|
||||
log_must check_vdev_state $TESTPOOL draid1-0-3 "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL draid1-0-3 "INUSE"
|
||||
|
||||
# Normal online device replacement
|
||||
new_vdev1="$BASEDIR/new_vdev1"
|
||||
log_must truncate -s $MINVDEVSIZE $new_vdev1
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev1 "ONLINE"
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev1 $new_vdev1
|
||||
log_must check_vdev_state $TESTPOOL $new_vdev1 "ONLINE"
|
||||
|
||||
# Distributed spare online device replacement (then fault)
|
||||
log_must zpool replace -w $flags $TESTPOOL $BASEDIR/vdev3 draid1-0-4
|
||||
log_must check_vdev_state $TESTPOOL spare-3 "ONLINE"
|
||||
log_must check_vdev_state $TESTPOOL draid1-0-4 "ONLINE"
|
||||
log_must check_hotspare_state $TESTPOOL draid1-0-4 "INUSE"
|
||||
log_must zpool offline -f $TESTPOOL $BASEDIR/vdev3
|
||||
log_must check_vdev_state $TESTPOOL $BASEDIR/vdev3 "FAULTED"
|
||||
log_must check_vdev_state $TESTPOOL spare-3 "DEGRADED"
|
||||
|
||||
resilver_cksum=$(cksum_pool $TESTPOOL)
|
||||
if [[ $resilver_cksum != 0 ]]; then
|
||||
log_must zpool status -v $TESTPOOL
|
||||
log_fail "$replace_mode resilver cksum errors: $resilver_cksum"
|
||||
fi
|
||||
|
||||
if [[ "$replace_mode" = "healing" ]]; then
|
||||
log_must zpool scrub -w $TESTPOOL
|
||||
else
|
||||
if [[ $(get_tunable REBUILD_SCRUB_ENABLED) -eq 0 ]]; then
|
||||
log_must zpool scrub -w $TESTPOOL
|
||||
else
|
||||
log_must wait_scrubbed $TESTPOOL
|
||||
fi
|
||||
fi
|
||||
|
||||
log_must is_pool_scrubbed $TESTPOOL
|
||||
|
||||
scrub_cksum=$(cksum_pool $TESTPOOL)
|
||||
if [[ $scrub_cksum != 0 ]]; then
|
||||
log_must zpool status -v $TESTPOOL
|
||||
log_fail "scrub cksum errors: $scrub_cksum"
|
||||
fi
|
||||
|
||||
log_must check_pool_status $TESTPOOL "scan" "repaired 0B"
|
||||
log_must check_pool_status $TESTPOOL "scan" "with 0 errors"
|
||||
|
||||
log_must is_data_valid $TESTPOOL
|
||||
|
||||
cleanup
|
||||
done
|
||||
|
||||
log_pass "Verify resilver to dRAID distributed spares"
|
||||
+2
-2
@@ -48,7 +48,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify raidz pool can withstand one device is failing."
|
||||
log_assert "Verify raidz pool can withstand one device failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 2 5)
|
||||
@@ -74,4 +74,4 @@ log_must recover_bad_missing_devs $TESTPOOL 1
|
||||
remove_devs $TESTPOOL 1
|
||||
log_must is_data_valid $TESTPOOL
|
||||
|
||||
log_pass "Raidz pool can withstand one devices is failing passed."
|
||||
log_pass "raidz pool can withstand one device failing passed."
|
||||
+2
-2
@@ -48,7 +48,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify raidz2 pool can withstand two devices are failing."
|
||||
log_assert "Verify raidz2 pool can withstand two devices failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 3 5)
|
||||
@@ -81,4 +81,4 @@ for i in 1 2; do
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
log_pass "Raidz2 pool can withstand two devices are failing passed."
|
||||
log_pass "raidz2 pool can withstand two devices failing passed."
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/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 http://www.opensolaris.org/os/licensing.
|
||||
# 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 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# A raidz3 pool can withstand 3 devices are failing or missing.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create N(>4,<5) virtual disk files.
|
||||
# 2. Create raidz3 pool based on the virtual disk files.
|
||||
# 3. Fill the filesystem with directories and files.
|
||||
# 4. Record all the files and directories checksum information.
|
||||
# 5. Damaged at most two of the virtual disk files.
|
||||
# 6. Verify the data is correct to prove raidz3 can withstand 3 devices
|
||||
# are failing.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Verify raidz3 pool can withstand three devices failing."
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i cnt=$(random_int_between 4 5)
|
||||
setup_test_env $TESTPOOL raidz3 $cnt
|
||||
|
||||
#
|
||||
# Inject data corruption errors for raidz3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
damage_devs $TESTPOOL $i "label"
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must clear_errors $TESTPOOL
|
||||
done
|
||||
|
||||
#
|
||||
# Inject bad devices errors for raidz3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
damage_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
#
|
||||
# Inject missing device errors for raidz3 pool
|
||||
#
|
||||
for i in 1 2 3; do
|
||||
remove_devs $TESTPOOL $i
|
||||
log_must is_data_valid $TESTPOOL
|
||||
log_must recover_bad_missing_devs $TESTPOOL $i
|
||||
done
|
||||
|
||||
log_pass "raidz3 pool can withstand three devices failing passed."
|
||||
@@ -38,7 +38,7 @@
|
||||
# Attaching disks during I/O should pass for supported pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz) and
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz/draid) and
|
||||
# start some random I/O
|
||||
# 2. Attach a disk to the pool.
|
||||
# 3. Verify the integrity of the file system and the resilvering.
|
||||
@@ -152,7 +152,7 @@ done
|
||||
|
||||
log_note "Verify 'zpool attach' fails with non-mirrors."
|
||||
|
||||
for type in "" "raidz" "raidz1"; do
|
||||
for type in "" "raidz" "raidz1" "draid" "draid1"; do
|
||||
for op in "" "-f"; do
|
||||
create_pool $TESTPOOL1 $type $specials_list
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# Attaching disks during I/O should pass for supported pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz) and
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz/draid) and
|
||||
# start some random I/O
|
||||
# 2. Attach a disk to the pool.
|
||||
# 3. Verify the integrity of the file system and the resilvering.
|
||||
@@ -151,7 +151,7 @@ done
|
||||
|
||||
log_note "Verify 'zpool attach' fails with non-mirrors."
|
||||
|
||||
for type in "" "raidz" "raidz1"; do
|
||||
for type in "" "raidz" "raidz1" "draid"; do
|
||||
for op in "" "-f"; do
|
||||
create_pool $TESTPOOL1 $type $specials_list
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# Detaching disks during I/O should pass for supported pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz) and
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz/draid) and
|
||||
# start some random I/O
|
||||
# 2. Detach a disk from the pool.
|
||||
# 3. Verify the integrity of the file system and the resilvering.
|
||||
@@ -143,7 +143,7 @@ destroy_pool $TESTPOOL1
|
||||
|
||||
log_note "Verify 'zpool detach' fails with non-mirrors."
|
||||
|
||||
for type in "" "raidz" "raidz1"; do
|
||||
for type in "" "raidz" "raidz1" "draid"; do
|
||||
create_pool $TESTPOOL1 $type $specials_list
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Executing 'zpool replace -s' for raidz vdevs failed. Sequential
|
||||
# resilvers are only allowed for stripe/mirror pools.
|
||||
# resilvers are only allowed for stripe/mirror/dRAID pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a raidz pool, verify 'zpool replace -s' fails
|
||||
@@ -67,4 +67,9 @@ log_must zpool create $TESTPOOL1 mirror ${VDEV_FILES[0]} ${VDEV_FILES[1]}
|
||||
log_must zpool replace -s $TESTPOOL1 ${VDEV_FILES[1]} $SPARE_VDEV_FILE
|
||||
destroy_pool $TESTPOOL1
|
||||
|
||||
# draid
|
||||
log_must zpool create $TESTPOOL1 draid ${VDEV_FILES[@]}
|
||||
log_must zpool replace -s $TESTPOOL1 ${VDEV_FILES[1]} $SPARE_VDEV_FILE
|
||||
destroy_pool $TESTPOOL1
|
||||
|
||||
log_pass "Sequential resilver is not allowed for raidz vdevs"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
# Replacing disks during I/O should pass for supported pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create multidisk pools (stripe/mirror) and
|
||||
# 1. Create multidisk pools (stripe/mirror/draid) and
|
||||
# start some random I/O
|
||||
# 2. Replace a disk in the pool with another disk.
|
||||
# 3. Verify the integrity of the file system and the rebuilding.
|
||||
@@ -137,7 +137,7 @@ done
|
||||
#
|
||||
log_must truncate -s $MINVDEVSIZE $TESTDIR/$REPLACEFILE
|
||||
|
||||
for type in "" "mirror"; do
|
||||
for type in "" "mirror" "draid"; do
|
||||
for op in "" "-f"; do
|
||||
create_pool $TESTPOOL1 $type $specials_list
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# Replacing disks during I/O should pass for supported pools.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz) and
|
||||
# 1. Create multidisk pools (stripe/mirror/raidz/draid) and
|
||||
# start some random I/O
|
||||
# 2. Replace a disk in the pool with another disk.
|
||||
# 3. Verify the integrity of the file system and the resilvering.
|
||||
@@ -134,7 +134,7 @@ done
|
||||
#
|
||||
log_must truncate -s $MINVDEVSIZE $TESTDIR/$REPLACEFILE
|
||||
|
||||
for type in "" "raidz" "mirror"; do
|
||||
for type in "" "raidz" "mirror" "draid"; do
|
||||
for op in "" "-f"; do
|
||||
create_pool $TESTPOOL1 $type $specials_list
|
||||
log_must zfs create $TESTPOOL1/$TESTFS1
|
||||
|
||||
@@ -70,14 +70,20 @@ log_must set_tunable64 VDEV_MIN_MS_COUNT 32
|
||||
typeset VDEV_MAX_MB=$(( floor(4 * MINVDEVSIZE * 0.75 / 1024 / 1024) ))
|
||||
typeset VDEV_MIN_MB=$(( floor(4 * MINVDEVSIZE * 0.30 / 1024 / 1024) ))
|
||||
|
||||
for type in "" "mirror" "raidz2"; do
|
||||
for type in "" "mirror" "raidz2" "draid"; do
|
||||
|
||||
if [[ "$type" = "" ]]; then
|
||||
VDEVS="$TRIM_VDEV1"
|
||||
elif [[ "$type" = "mirror" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2"
|
||||
else
|
||||
elif [[ "$type" = "raidz2" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2 $TRIM_VDEV3"
|
||||
elif [[ "$type" = "draid" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2 $TRIM_VDEV3 $TRIM_VDEV4"
|
||||
|
||||
# The per-vdev utilization is lower due to the capacity
|
||||
# resilverd for the distributed spare.
|
||||
VDEV_MAX_MB=$(( floor(4 * MINVDEVSIZE * 0.50 / 1024 / 1024) ))
|
||||
fi
|
||||
|
||||
log_must truncate -s $((4 * MINVDEVSIZE)) $VDEVS
|
||||
|
||||
@@ -60,7 +60,7 @@ log_must set_tunable64 TRIM_EXTENT_BYTES_MIN 4096
|
||||
typeset trim_txg_batch=$(get_tunable TRIM_TXG_BATCH)
|
||||
log_must set_tunable64 TRIM_TXG_BATCH 8
|
||||
|
||||
for type in "" "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
for type in "" "mirror" "raidz" "draid"; do
|
||||
log_must truncate -s 1G $TRIM_VDEVS
|
||||
|
||||
log_must zpool create -f $TESTPOOL $type $TRIM_VDEVS
|
||||
|
||||
@@ -61,7 +61,7 @@ log_must set_tunable64 TRIM_EXTENT_BYTES_MIN 4096
|
||||
typeset trim_txg_batch=$(get_tunable TRIM_TXG_BATCH)
|
||||
log_must set_tunable64 TRIM_TXG_BATCH 8
|
||||
|
||||
for type in "" "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
for type in "" "mirror" "raidz" "raidz2" "draid" "draid2"; do
|
||||
log_must truncate -s 1G $TRIM_VDEVS
|
||||
|
||||
log_must zpool create -f $TESTPOOL $type $TRIM_VDEVS
|
||||
|
||||
@@ -70,14 +70,20 @@ log_must set_tunable64 VDEV_MIN_MS_COUNT 32
|
||||
typeset VDEV_MAX_MB=$(( floor(4 * MINVDEVSIZE * 0.75 / 1024 / 1024) ))
|
||||
typeset VDEV_MIN_MB=$(( floor(4 * MINVDEVSIZE * 0.30 / 1024 / 1024) ))
|
||||
|
||||
for type in "" "mirror" "raidz2"; do
|
||||
for type in "" "mirror" "raidz2" "draid"; do
|
||||
|
||||
if [[ "$type" = "" ]]; then
|
||||
VDEVS="$TRIM_VDEV1"
|
||||
elif [[ "$type" = "mirror" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2"
|
||||
else
|
||||
elif [[ "$type" = "raidz2" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2 $TRIM_VDEV3"
|
||||
elif [[ "$type" = "draid" ]]; then
|
||||
VDEVS="$TRIM_VDEV1 $TRIM_VDEV2 $TRIM_VDEV3 $TRIM_VDEV4"
|
||||
|
||||
# The per-vdev utilization is lower due to the capacity
|
||||
# resilverd for the distributed spare.
|
||||
VDEV_MAX_MB=$(( floor(4 * MINVDEVSIZE * 0.50 / 1024 / 1024) ))
|
||||
fi
|
||||
|
||||
log_must truncate -s $((4 * MINVDEVSIZE)) $VDEVS
|
||||
|
||||
@@ -60,7 +60,7 @@ log_must set_tunable64 TRIM_EXTENT_BYTES_MIN 4096
|
||||
typeset trim_txg_batch=$(get_tunable TRIM_TXG_BATCH)
|
||||
log_must set_tunable64 TRIM_TXG_BATCH 8
|
||||
|
||||
for type in "" "mirror" "raidz" "raidz2" "raidz3"; do
|
||||
for type in "" "mirror" "raidz" "draid"; do
|
||||
log_must truncate -s 1G $TRIM_VDEVS
|
||||
|
||||
log_must zpool create -f $TESTPOOL $type $TRIM_VDEVS
|
||||
|
||||
Reference in New Issue
Block a user