-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add scrub after resilver zed script #7086
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# resilver_finish-start-scrub.sh | ||
# Run a scrub after a resilver | ||
# | ||
# Exit codes: | ||
# 1: Internal error | ||
# 2: Script wasn't enabled in zed.rc | ||
[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" | ||
. "${ZED_ZEDLET_DIR}/zed-functions.sh" | ||
|
||
[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2 | ||
[ -n "${ZEVENT_POOL}" ] || exit 1 | ||
[ -n "${ZEVENT_SUBCLASS}" ] || exit 1 | ||
zed_check_cmd "${ZPOOL}" || exit 1 | ||
|
||
zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}" | ||
"${ZPOOL}" scrub "${ZEVENT_POOL}" |
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
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 |
---|---|---|
|
@@ -86,6 +86,7 @@ export SYSTEM_FILES='arp | |
pgrep | ||
ping | ||
pkill | ||
printenv | ||
printf | ||
ps | ||
pwd | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,6 @@ | |
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
zed_cleanup | ||
zed_cleanup all-debug.sh all-syslog.sh | ||
|
||
default_cleanup |
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 |
---|---|---|
|
@@ -28,6 +28,6 @@ | |
|
||
DISK=${DISKS%% *} | ||
|
||
zed_setup | ||
zed_setup all-debug.sh all-syslog.sh | ||
|
||
default_setup $DISK |
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
65 changes: 65 additions & 0 deletions
65
tests/zfs-tests/tests/functional/fault/scrub_after_resilver.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,65 @@ | ||
#!/bin/ksh -p | ||
# | ||
# 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. | ||
# | ||
|
||
# | ||
# Copyright (c) 2018 by Lawrence Livermore National Security, LLC. | ||
# All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/fault/fault.cfg | ||
|
||
# | ||
# DESCRIPTION: | ||
# Test the scrub after resilver zedlet | ||
# | ||
# STRATEGY: | ||
# 1. Create a mirrored pool | ||
# 2. Fault a disk | ||
# 3. Replace the disk, starting a resilver | ||
# 4. Verify that a scrub happens after the resilver finishes | ||
# | ||
|
||
log_assert "Testing the scrub after resilver zedlet" | ||
|
||
# Backup our zed.rc | ||
zedrc_backup="$(mktemp)" | ||
log_must cp $ZEDLET_DIR/zed.rc $zedrc_backup | ||
|
||
# Enable ZED_SCRUB_AFTER_RESILVER | ||
eval "sed -i 's/\#ZED_SCRUB_AFTER_RESILVER/ZED_SCRUB_AFTER_RESILVER/g' $ZEDLET_DIR/zed.rc" | ||
|
||
function cleanup | ||
{ | ||
# Restore our zed.rc | ||
log_must mv $zedrc_backup $ZEDLET_DIR/zed.rc | ||
default_cleanup_noexit | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
verify_disk_count "$DISKS" 3 | ||
default_mirror_setup_noexit $DISK1 $DISK2 | ||
|
||
log_must zpool offline -f $TESTPOOL $DISK1 | ||
|
||
# Write to our degraded pool so we have some data to resilver | ||
log_must mkfile 16M $TESTDIR/file1 | ||
|
||
# Replace the failed disks, forcing a resilver | ||
log_must zpool replace $TESTPOOL $DISK1 $DISK3 | ||
|
||
# Wait for the resilver to finish, and then the subsequent scrub to finish. | ||
# Waiting for the scrub has the effect of waiting for both. Timeout after 10 | ||
# seconds if nothing is happening. | ||
log_must wait_scrubbed $TESTPOOL 10 | ||
log_pass "Successfully ran the scrub after resilver zedlet" |
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
|
||
verify_runnable "global" | ||
|
||
zed_setup | ||
zed_setup resilver_finish-start-scrub.sh | ||
zed_start | ||
|
||
log_pass |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anything actually check this variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I'll fix that in next push