Skip to content
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

ZTS: Improve zts-auto_offline_001_pos #9827

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ filedev3="$TEST_BASE_DIR/file-vdev-3"
sparedev="$TEST_BASE_DIR/file-vdev-spare"
removedev=$(get_debug_device)

typeset poolconfs=("mirror $filedev1 $removedev"
"raidz $filedev1 $removedev"
"raidz2 $filedev1 $filedev2 $removedev"
typeset poolconfs=(
"mirror $filedev1 $removedev"
"raidz3 $filedev1 $filedev2 $filedev3 $removedev"
"$filedev1 cache $removedev"
"mirror $filedev1 $filedev2 cache $removedev"
"raidz $filedev1 $filedev2 $filedev3 cache $removedev"
"mirror $filedev1 $filedev2 special mirror $filedev3 $removedev"
)

log_must truncate -s $SPA_MINDEVSIZE $filedev1
Expand All @@ -91,7 +89,7 @@ for conf in "${poolconfs[@]}"
do
# 1. Create a pool
log_must zpool create -f $TESTPOOL $conf
block_device_wait
block_device_wait ${DEV_DSKDIR}/${removedev}

# 2. Simulate physical removal of one device
remove_disk $removedev
Expand All @@ -107,8 +105,8 @@ do

# cleanup
destroy_pool $TESTPOOL
log_must parted "/dev/${removedev}" -s -- mklabel msdos
block_device_wait
log_must parted "${DEV_DSKDIR}/${removedev}" -s -- mklabel msdos
block_device_wait ${DEV_DSKDIR}/${removedev}
done

# 6. Repeat the same tests with a spare device: zed will use the spare to handle
Expand All @@ -117,7 +115,7 @@ for conf in "${poolconfs[@]}"
do
# 1. Create a pool with a spare
log_must zpool create -f $TESTPOOL $conf
block_device_wait
block_device_wait ${DEV_DSKDIR}/${removedev}
log_must zpool add $TESTPOOL spare $sparedev

# 3. Simulate physical removal of one device
Expand All @@ -139,8 +137,8 @@ do

# cleanup
destroy_pool $TESTPOOL
log_must parted "/dev/${removedev}" -s -- mklabel msdos
block_device_wait
log_must parted "${DEV_DSKDIR}/${removedev}" -s -- mklabel msdos
block_device_wait ${DEV_DSKDIR}/${removedev}
done

# 7. Repeat the same tests again with a faulted spare device: zed should offline
Expand All @@ -149,7 +147,7 @@ for conf in "${poolconfs[@]}"
do
# 1. Create a pool with a spare
log_must zpool create -f $TESTPOOL $conf
block_device_wait
block_device_wait ${DEV_DSKDIR}/${removedev}
log_must zpool add $TESTPOOL spare $sparedev

# 2. Fault the spare device making it unavailable
Expand All @@ -170,8 +168,8 @@ do

# cleanup
destroy_pool $TESTPOOL
log_must parted "/dev/${removedev}" -s -- mklabel msdos
block_device_wait
log_must parted "${DEV_DSKDIR}/${removedev}" -s -- mklabel msdos
block_device_wait ${DEV_DSKDIR}/${removedev}
done

log_pass "ZED detects physically removed devices"