mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
ZTS: Fix and change testcase cache_010_neg
Commit 379ca9c
removed the requirement on aux devices to be block
devices only but the test case cache_010_neg was not updated, making it
fail consistently.
This change changes the test to check that cache devices _can_ be
anything that presents a block interface. The testcase is renamed to
cache_010_pos and the exceptions for known failure removed from the test
runner.
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Alex John <alex@stty.io>
Closes #10172
This commit is contained in:
parent
20f287855a
commit
c602b35cf7
@ -49,7 +49,7 @@ post =
|
|||||||
[tests/functional/cache]
|
[tests/functional/cache]
|
||||||
tests = ['cache_001_pos', 'cache_002_pos', 'cache_003_pos', 'cache_004_neg',
|
tests = ['cache_001_pos', 'cache_002_pos', 'cache_003_pos', 'cache_004_neg',
|
||||||
'cache_005_neg', 'cache_006_pos', 'cache_007_neg', 'cache_008_neg',
|
'cache_005_neg', 'cache_006_pos', 'cache_007_neg', 'cache_008_neg',
|
||||||
'cache_009_pos', 'cache_010_neg', 'cache_011_pos', 'cache_012_pos']
|
'cache_009_pos', 'cache_010_pos', 'cache_011_pos', 'cache_012_pos']
|
||||||
tags = ['functional', 'cache']
|
tags = ['functional', 'cache']
|
||||||
|
|
||||||
[tests/functional/cachefile]
|
[tests/functional/cachefile]
|
||||||
|
@ -191,7 +191,6 @@ elif sys.platform.startswith('linux'):
|
|||||||
maybe = {
|
maybe = {
|
||||||
'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
|
'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
|
||||||
'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
|
'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
|
||||||
'cache/cache_010_neg': ['FAIL', known_reason],
|
|
||||||
'chattr/setup': ['SKIP', exec_reason],
|
'chattr/setup': ['SKIP', exec_reason],
|
||||||
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
|
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
|
||||||
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
|
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
|
||||||
|
@ -11,7 +11,7 @@ dist_pkgdata_SCRIPTS = \
|
|||||||
cache_007_neg.ksh \
|
cache_007_neg.ksh \
|
||||||
cache_008_neg.ksh \
|
cache_008_neg.ksh \
|
||||||
cache_009_pos.ksh \
|
cache_009_pos.ksh \
|
||||||
cache_010_neg.ksh \
|
cache_010_pos.ksh \
|
||||||
cache_011_pos.ksh \
|
cache_011_pos.ksh \
|
||||||
cache_012_pos.ksh
|
cache_012_pos.ksh
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# Verify cache device must be a block device.
|
# Verify that cache devices can be block devices, files or character devices
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. Create a pool
|
# 1. Create a pool
|
||||||
# 2. Add different object as cache
|
# 2. Add different object as cache
|
||||||
# 3. Verify character devices and files fail
|
# 3. Verify character devices and files pass
|
||||||
#
|
#
|
||||||
|
|
||||||
verify_runnable "global"
|
verify_runnable "global"
|
||||||
@ -50,51 +50,55 @@ function cleanup_testenv
|
|||||||
if [[ -n $lofidev ]]; then
|
if [[ -n $lofidev ]]; then
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
losetup -d $lofidev
|
losetup -d $lofidev
|
||||||
|
elif is_freebsd; then
|
||||||
|
mdconfig -du ${lofidev#md}
|
||||||
else
|
else
|
||||||
lofiadm -d $lofidev
|
lofiadm -d $lofidev
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
log_assert "Cache device can only be block devices."
|
log_assert "Verify cache devices can be disk, file, lofi device or any " \
|
||||||
|
"device that presents a block interface"
|
||||||
|
|
||||||
|
verify_disk_count "$DISKS" 2
|
||||||
log_onexit cleanup_testenv
|
log_onexit cleanup_testenv
|
||||||
|
|
||||||
TESTVOL=testvol1$$
|
TESTVOL=testvol1$$
|
||||||
dsk1=${DISKS%% *}
|
dsk1=${DISKS%% *}
|
||||||
log_must zpool create $TESTPOOL ${DISKS#$dsk1}
|
log_must zpool create $TESTPOOL ${DISKS#$dsk1}
|
||||||
|
|
||||||
# Add nomal ${DEV_RDSKDIR} device
|
# Add normal ${DEV_RDSKDIR} device
|
||||||
log_must zpool add $TESTPOOL cache \
|
log_must zpool add $TESTPOOL cache \
|
||||||
${DEV_RDSKDIR}/${dsk1}${SLICE_PREFIX}${SLICE0}
|
${DEV_RDSKDIR}/${dsk1}
|
||||||
|
log_must zpool remove $TESTPOOL ${DEV_RDSKDIR}/${dsk1}
|
||||||
|
|
||||||
|
|
||||||
|
# Add provided disk
|
||||||
|
log_must zpool add $TESTPOOL cache $dsk1
|
||||||
log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
|
log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
|
||||||
|
log_must zpool remove $TESTPOOL $dsk1
|
||||||
|
|
||||||
# Add normal file
|
# Add normal file
|
||||||
log_mustnot zpool add $TESTPOOL cache $VDEV2
|
log_must zpool add $TESTPOOL cache $VDEV
|
||||||
|
ldev=$(random_get $VDEV)
|
||||||
|
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
|
||||||
|
|
||||||
# Add /dev/rlofi device (allowed under Linux)
|
# Add loop back device
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
lofidev=$(losetup -f)
|
lofidev=$(losetup -f)
|
||||||
lofidev=${lofidev##*/}
|
|
||||||
log_must losetup $lofidev ${VDEV2%% *}
|
log_must losetup $lofidev ${VDEV2%% *}
|
||||||
log_must zpool add $TESTPOOL cache $lofidev
|
lofidev=${lofidev##*/}
|
||||||
log_must zpool remove $TESTPOOL $lofidev
|
elif is_freebsd; then
|
||||||
log_must losetup -d $lofidev
|
lofidev=$(mdconfig -a ${VDEV2%% *})
|
||||||
lofidev=""
|
|
||||||
else
|
else
|
||||||
lofidev=${VDEV2%% *}
|
lofidev=${VDEV2%% *}
|
||||||
log_must lofiadm -a $lofidev
|
log_must lofiadm -a $lofidev
|
||||||
lofidev=$(lofiadm $lofidev)
|
lofidev=$(lofiadm $lofidev)
|
||||||
log_mustnot zpool add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
|
|
||||||
log_must lofiadm -d $lofidev
|
|
||||||
lofidev=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add /dev/zvol/rdsk device (allowed under Linux)
|
log_must zpool add $TESTPOOL cache $lofidev
|
||||||
if ! is_linux; then
|
log_must verify_cache_device $TESTPOOL $lofidev 'ONLINE'
|
||||||
log_must zpool create $TESTPOOL2 $VDEV2
|
|
||||||
log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL
|
|
||||||
log_mustnot zpool add $TESTPOOL cache \
|
|
||||||
${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_pass "Cache device can only be block devices."
|
log_pass "Verify cache devices can be disk, file, lofi device or any " \
|
||||||
|
"device that presents a block interface"
|
@ -34,10 +34,6 @@
|
|||||||
|
|
||||||
verify_runnable "global"
|
verify_runnable "global"
|
||||||
|
|
||||||
if ! is_physical_device $LDEV; then
|
|
||||||
log_unsupported "Only physical disk could be cache device"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_must rm -rf $VDIR $VDIR2
|
log_must rm -rf $VDIR $VDIR2
|
||||||
log_must mkdir -p $VDIR $VDIR2
|
log_must mkdir -p $VDIR $VDIR2
|
||||||
log_must mkfile $SIZE $VDEV $VDEV2
|
log_must mkfile $SIZE $VDEV $VDEV2
|
||||||
|
Loading…
Reference in New Issue
Block a user