forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'zpool status -e' flag to see unhealthy vdevs
When very large pools are present, it can be laborious to find reasons for why a pool is degraded and/or where an unhealthy vdev is. This option filters out vdevs that are ONLINE and with no errors to make it easier to see where the issues are. Root and parents of unhealthy vdevs will always be printed. Testing: ZFS errors and drive failures for multiple vdevs were simulated with zinject. Sample vdev listings with '-e' option - All vdevs healthy NAME STATE READ WRITE CKSUM iron5 ONLINE 0 0 0 - ZFS errors NAME STATE READ WRITE CKSUM iron5 ONLINE 0 0 0 raidz2-5 ONLINE 1 0 0 L23 ONLINE 1 0 0 L24 ONLINE 1 0 0 L37 ONLINE 1 0 0 - Vdev faulted NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-6 DEGRADED 0 0 0 L67 FAULTED 0 0 0 too many errors - Vdev faults and data errors NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-1 DEGRADED 0 0 0 L2 FAULTED 0 0 0 too many errors raidz2-5 ONLINE 1 0 0 L23 ONLINE 1 0 0 L24 ONLINE 1 0 0 L37 ONLINE 1 0 0 raidz2-6 DEGRADED 0 0 0 L67 FAULTED 0 0 0 too many errors - Vdev missing NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-6 DEGRADED 0 0 0 L67 UNAVAIL 3 1 0 - Slow devices when -s provided with -e NAME STATE READ WRITE CKSUM SLOW iron5 DEGRADED 0 0 0 - raidz2-5 DEGRADED 0 0 0 - L10 FAULTED 0 0 0 0 external device fault L51 ONLINE 0 0 0 14 Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Cameron Harr <harr1@llnl.gov> Closes openzfs#15769
- Loading branch information
Showing
7 changed files
with
169 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_008_pos.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/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) 2024 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify 'zpool status -e' only shows unhealthy devices. | ||
# | ||
# STRATEGY: | ||
# 1. Create zpool | ||
# 2. Force DEGRADE, FAULT, or inject slow IOs for vdevs | ||
# 3. Verify vdevs are reported correctly with -e and -s | ||
# 4. Verify parents are reported as DEGRADED | ||
# 5. Verify healthy children are not reported | ||
# | ||
|
||
function cleanup | ||
{ | ||
log_must set_tunable64 ZIO_SLOW_IO_MS $OLD_SLOW_IO | ||
zinject -c all | ||
poolexists $TESTPOOL2 && destroy_pool $TESTPOOL2 | ||
log_must rm -f $all_vdevs | ||
} | ||
|
||
log_assert "Verify 'zpool status -e'" | ||
|
||
log_onexit cleanup | ||
|
||
all_vdevs=$(echo $TESTDIR/vdev{1..6}) | ||
log_must mkdir -p $TESTDIR | ||
log_must truncate -s $MINVDEVSIZE $all_vdevs | ||
|
||
OLD_SLOW_IO=$(get_tunable ZIO_SLOW_IO_MS) | ||
|
||
for raid_type in "draid2:3d:6c:1s" "raidz2"; do | ||
|
||
log_must zpool create -f $TESTPOOL2 $raid_type $all_vdevs | ||
|
||
# Check DEGRADED vdevs are shown. | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev4 "ONLINE" | ||
log_must zinject -d $TESTDIR/vdev4 -A degrade $TESTPOOL2 | ||
log_must eval "zpool status -e $TESTPOOL2 | grep $TESTDIR/vdev4 | grep DEGRADED" | ||
|
||
# Check FAULTED vdevs are shown. | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev5 "ONLINE" | ||
log_must zinject -d $TESTDIR/vdev5 -A fault $TESTPOOL2 | ||
log_must eval "zpool status -e $TESTPOOL2 | grep $TESTDIR/vdev5 | grep FAULTED" | ||
|
||
# Check no ONLINE vdevs are shown | ||
log_mustnot eval "zpool status -e $TESTPOOL2 | grep ONLINE" | ||
|
||
# Check no ONLINE slow vdevs are show. Then mark IOs greater than | ||
# 10ms slow, delay IOs 20ms to vdev6, check slow IOs. | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev6 "ONLINE" | ||
log_mustnot eval "zpool status -es $TESTPOOL2 | grep ONLINE" | ||
|
||
log_must set_tunable64 ZIO_SLOW_IO_MS 10 | ||
log_must zinject -d $TESTDIR/vdev6 -D20:100 $TESTPOOL2 | ||
log_must mkfile 1048576 /$TESTPOOL2/testfile | ||
sync_pool $TESTPOOL2 | ||
log_must set_tunable64 ZIO_SLOW_IO_MS $OLD_SLOW_IO | ||
|
||
# Check vdev6 slow IOs are only shown when requested with -s. | ||
log_mustnot eval "zpool status -e $TESTPOOL2 | grep $TESTDIR/vdev6 | grep ONLINE" | ||
log_must eval "zpool status -es $TESTPOOL2 | grep $TESTDIR/vdev6 | grep ONLINE" | ||
|
||
# Pool level and top-vdev level status must be DEGRADED. | ||
log_must eval "zpool status -e $TESTPOOL2 | grep $TESTPOOL2 | grep DEGRADED" | ||
log_must eval "zpool status -e $TESTPOOL2 | grep $raid_type | grep DEGRADED" | ||
|
||
# Check that healthy vdevs[1-3] aren't shown with -e. | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev1 "ONLINE" | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev2 "ONLINE" | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev3 "ONLINE" | ||
log_mustnot eval "zpool status -es $TESTPOOL2 | grep $TESTDIR/vdev1 | grep ONLINE" | ||
log_mustnot eval "zpool status -es $TESTPOOL2 | grep $TESTDIR/vdev2 | grep ONLINE" | ||
log_mustnot eval "zpool status -es $TESTPOOL2 | grep $TESTDIR/vdev3 | grep ONLINE" | ||
|
||
log_must zinject -c all | ||
log_must zpool status -es $TESTPOOL2 | ||
|
||
zpool destroy $TESTPOOL2 | ||
done | ||
|
||
log_pass "Verify zpool status -e shows only unhealthy vdevs" |