mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
ZTS: Add auto-spare tests
The ZED is expected to automatically kick in a hot spare device when there's one available in the pool and a sufficient number of read errors have been encountered. Use zinject to simulate the failure condition and verify the hot spare is used. auto_spare_001_pos.ksh: read IO errors, the vdev is FAULTED auto_spare_002_pos.ksh: read CHECKSUM errors, the vdev is DEGRADE Reviewed by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: David Quigley <david.quigley@intel.com> Closes #6280
This commit is contained in:
committed by
Brian Behlendorf
parent
f8cd871a01
commit
d9daa7abcf
@@ -2029,6 +2029,31 @@ function check_hotspare_state # pool disk state{inuse,avail}
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Wait until a hotspare transitions to a given state or times out.
|
||||
#
|
||||
# Return 0 when pool/disk matches expected state, 1 on timeout.
|
||||
#
|
||||
function wait_hotspare_state # pool disk state timeout
|
||||
{
|
||||
typeset pool=$1
|
||||
typeset disk=${2#$/DEV_DSKDIR/}
|
||||
typeset state=$3
|
||||
typeset timeout=${4:-60}
|
||||
typeset -i i=0
|
||||
|
||||
while [[ $i -lt $timeout ]]; do
|
||||
if check_hotspare_state $pool $disk $state; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
i=$((i+1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Verify a given slog disk is inuse or avail
|
||||
#
|
||||
@@ -2067,6 +2092,31 @@ function check_vdev_state # pool disk state{online,offline,unavail}
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Wait until a vdev transitions to a given state or times out.
|
||||
#
|
||||
# Return 0 when pool/disk matches expected state, 1 on timeout.
|
||||
#
|
||||
function wait_vdev_state # pool disk state timeout
|
||||
{
|
||||
typeset pool=$1
|
||||
typeset disk=${2#$/DEV_DSKDIR/}
|
||||
typeset state=$3
|
||||
typeset timeout=${4:-60}
|
||||
typeset -i i=0
|
||||
|
||||
while [[ $i -lt $timeout ]]; do
|
||||
if check_vdev_state $pool $disk $state; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
i=$((i+1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Check the output of 'zpool status -v <pool>',
|
||||
# and to see if the content of <token> contain the <keyword> specified.
|
||||
|
||||
Reference in New Issue
Block a user