-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add 'zpool status -e' flag to see unhealthy vdevs #15769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.