mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-11 09:18:25 +03:00
tests: writeerror_dev
Intruduce aux function for easy simulation of disk areas, that are 'normally' readable, but will fail on write.
This commit is contained in:
parent
440ced192a
commit
9b41118b9c
@ -564,6 +564,8 @@ teardown() {
|
||||
echo -n "## teardown..."
|
||||
unset LVM_LOG_FILE_EPOCH
|
||||
|
||||
test ! -f ERR_DEV || should dmsetup remove $(cat ERR_DEV_NAME)
|
||||
|
||||
if test -f TESTNAME ; then
|
||||
|
||||
if test ! -f SKIP_THIS_TEST ; then
|
||||
@ -985,6 +987,8 @@ common_dev_() {
|
||||
case "$tgtype" in
|
||||
delay)
|
||||
echo "$from $len delay $pvdev $(( pos + offset )) $read_ms $pvdev $(( pos + offset )) $write_ms" ;;
|
||||
writeerror)
|
||||
echo "$from $len delay $pvdev $(( pos + offset )) 0 $(cat ERR_DEV) 0 0" ;;
|
||||
error|zero)
|
||||
echo "$from $len $tgtype" ;;
|
||||
esac
|
||||
@ -1124,6 +1128,24 @@ error_dev() {
|
||||
common_dev_ error "$@"
|
||||
}
|
||||
|
||||
#
|
||||
# Convert device to device with write errors but normal reads.
|
||||
# For this 'delay' dev is used and reroutes 'reads' back to original device
|
||||
# and for writes it will use extra new TEST-errordev (huge error target)
|
||||
# i.e. writeerror_dev "$dev1" 8:32
|
||||
writeerror_dev() {
|
||||
local name=${PREFIX}-errordev
|
||||
|
||||
if test ! -e ERR_DEV; then
|
||||
dmsetup create -u "TEST-$name" "$name" --table "0 4611686018427387904 error"
|
||||
# Take major:minor of our error device
|
||||
echo "$name" > ERR_DEV_NAME
|
||||
dmsetup info -c --noheadings -o major,minor "$name" > ERR_DEV
|
||||
fi
|
||||
|
||||
common_dev_ writeerror "$@"
|
||||
}
|
||||
|
||||
#
|
||||
# Convert existing device to a device with zero segments
|
||||
# Takes the list of pairs of zero segment from:len
|
||||
|
Loading…
Reference in New Issue
Block a user