1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: double quote

This commit is contained in:
Zdenek Kabelac 2017-07-10 10:40:09 +02:00
parent 5ca4fd0478
commit 24751b45bd
63 changed files with 349 additions and 353 deletions

View File

@ -374,8 +374,8 @@ compare_fields() {
local field2=$6 local field2=$6
local val1 local val1
local val2 local val2
val1=$($cmd1 --noheadings -o "$field1" "$obj1") val1=$("$cmd1" --noheadings -o "$field1" "$obj1")
val2=$($cmd2 --noheadings -o "$field2" "$obj2") val2=$("$cmd2" --noheadings -o "$field2" "$obj2")
test "$val1" = "$val2" || \ test "$val1" = "$val2" || \
die "compare_fields $obj1($field1): $val1 $obj2($field2): $val2" die "compare_fields $obj1($field1): $val1 $obj2($field2): $val2"
} }

View File

@ -10,7 +10,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
initskip() { initskip() {
test "$#" -eq 0 || echo "TEST SKIPPED: " "$@" test $# -eq 0 || echo "TEST SKIPPED:" "$@"
exit 200 exit 200
} }

View File

@ -27,7 +27,7 @@ CLVMD_SOCKET="/var/run/lvm/clvmd.sock"
restart_clvmd_() { restart_clvmd_() {
"$LVM_CLVMD_BINARY" -S "$LVM_CLVMD_BINARY" -S
ls -la $CLVMD_SOCKET || true ls -la "$CLVMD_SOCKET" || true
for i in $(seq 1 20) ; do for i in $(seq 1 20) ; do
test -S "$CLVMD_SOCKET" && break test -S "$CLVMD_SOCKET" && break

View File

@ -33,7 +33,7 @@ lvchange --monitor y --verbose $vg/4way 2>&1 | tee lvchange.out
grep 'already monitored' lvchange.out grep 'already monitored' lvchange.out
# now try what happens if no dmeventd is running # now try what happens if no dmeventd is running
kill -9 $(< LOCAL_DMEVENTD) kill -9 "$(< LOCAL_DMEVENTD)"
rm LOCAL_DMEVENTD rm LOCAL_DMEVENTD
dmeventd -R -f & dmeventd -R -f &

View File

@ -23,8 +23,8 @@ HIDENKEY_32=0000000000000000000000000000000000000000000000000000000000000000
KEY_NAME="$PREFIX:keydesc" KEY_NAME="$PREFIX:keydesc"
function _teardown() { function _teardown() {
keyctl unlink %:$PREFIX-keyring keyctl unlink "%:$PREFIX-keyring"
aux teardown_devs_prefixed $PREFIX aux teardown_devs_prefixed "$PREFIX"
} }
aux target_at_least dm-zero 1 0 0 || skip "missing dm-zero target" aux target_at_least dm-zero 1 0 0 || skip "missing dm-zero target"
@ -32,45 +32,45 @@ aux target_at_least dm-crypt 1 15 0 || skip "dm-crypt doesn't support keys in ke
which keyctl || skip "test requires keyctl utility" which keyctl || skip "test requires keyctl utility"
keyctl new_session || true # fails with 'su', works with 'su -' keyctl new_session || true # fails with 'su', works with 'su -'
keyctl newring $PREFIX-keyring @s keyctl newring "$PREFIX-keyring" @s
keyctl timeout %:$PREFIX-keyring 60 keyctl timeout "%:$PREFIX-keyring" 60
trap '_teardown' EXIT trap '_teardown' EXIT
keyctl add logon $KEY_NAME ${HEXKEY_32:0:32} %:$PREFIX-keyring keyctl add logon "$KEY_NAME" "${HEXKEY_32:0:32}" "%:$PREFIX-keyring"
dmsetup create $PREFIX-zero --table "0 1 zero" dmsetup create "$PREFIX-zero" --table "0 1 zero"
# put key in kernel keyring for active table # put key in kernel keyring for active table
dmsetup create $PREFIX-crypt --table "0 1 crypt $CIPHER :32:logon:$KEY_NAME 0 $TESTDIR/dev$prefix/mapper/$PREFIX-zero 0" dmsetup create "$PREFIX-crypt" --table "0 1 crypt $CIPHER :32:logon:$KEY_NAME 0 $DM_DEV_DIR/mapper/$PREFIX-zero 0"
# put hexbyte key in dm-crypt directly in inactive table # put hexbyte key in dm-crypt directly in inactive table
dmsetup load $PREFIX-crypt --table "0 1 crypt $CIPHER $HEXKEY_32 0 $TESTDIR/dev$prefix/mapper/$PREFIX-zero 0" dmsetup load "$PREFIX-crypt" --table "0 1 crypt $CIPHER $HEXKEY_32 0 $DM_DEV_DIR/mapper/$PREFIX-zero 0"
# test dmsetup doesn't hide key descriptions... # test dmsetup doesn't hide key descriptions...
str=`dmsetup table $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = :32:logon:$KEY_NAME test "$str" = ":32:logon:$KEY_NAME"
str=`dmsetup table --showkeys $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --showkeys "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = :32:logon:$KEY_NAME test "$str" = ":32:logon:$KEY_NAME"
# ...but it hides hexbyte representation of keys... # ...but it hides hexbyte representation of keys...
str=`dmsetup table --inactive $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --inactive "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = $HIDENKEY_32 test "$str" = "$HIDENKEY_32"
#...unless --showkeys explictly requested #...unless --showkeys explictly requested
str=`dmsetup table --showkeys --inactive $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --showkeys --inactive "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = $HEXKEY_32 test "$str" = "$HEXKEY_32"
# let's swap the tables # let's swap the tables
dmsetup resume $PREFIX-crypt dmsetup resume "$PREFIX-crypt"
dmsetup load $PREFIX-crypt --table "0 1 crypt $CIPHER :32:logon:$KEY_NAME 0 $TESTDIR/dev$prefix/mapper/$PREFIX-zero 0" dmsetup load "$PREFIX-crypt" --table "0 1 crypt $CIPHER :32:logon:$KEY_NAME 0 $DM_DEV_DIR/mapper/$PREFIX-zero 0"
str=`dmsetup table --inactive $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --inactive "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = :32:logon:$KEY_NAME test "$str" = ":32:logon:$KEY_NAME"
str=`dmsetup table --showkeys --inactive $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --showkeys --inactive "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = :32:logon:$KEY_NAME test "$str" = ":32:logon:$KEY_NAME"
str=`dmsetup table $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = $HIDENKEY_32 test "$str" = "$HIDENKEY_32"
str=`dmsetup table --showkeys $PREFIX-crypt | cut -d ' ' -f 5` str=$(dmsetup table --showkeys "$PREFIX-crypt" | cut -d ' ' -f 5)
test $str = $HEXKEY_32 test "$str" = "$HEXKEY_32"
dmsetup remove $PREFIX-crypt dmsetup remove "$PREFIX-crypt"
dmsetup remove $PREFIX-zero dmsetup remove "$PREFIX-zero"

View File

@ -33,11 +33,11 @@ pvcreate --metadatacopies 0 "$dev5"
#COMM bz195276 -- pvs doesn't show PVs until a VG is created #COMM bz195276 -- pvs doesn't show PVs until a VG is created
pvs --noheadings "${DEVICES[@]}" pvs --noheadings "${DEVICES[@]}"
test $(pvs --noheadings "${DEVICES[@]}" | wc -l) -eq 5 test "$(pvs --noheadings "${DEVICES[@]}" | wc -l)" -eq 5
pvdisplay pvdisplay
#COMM pvs with segment attributes works even for orphans #COMM pvs with segment attributes works even for orphans
test $(pvs --noheadings -o seg_all,pv_all,lv_all,vg_all "${DEVICES[@]}" | wc -l) -eq 5 test "$(pvs --noheadings -o seg_all,pv_all,lv_all,vg_all "${DEVICES[@]}" | wc -l)" -eq 5
vgcreate $vg "${DEVICES[@]}" vgcreate $vg "${DEVICES[@]}"
@ -59,16 +59,16 @@ check pv_field "$dev2" vg_name $vg
#COMM lvs displays snapshots (bz171215) #COMM lvs displays snapshots (bz171215)
lvcreate -aey -l4 -n $lv1 $vg lvcreate -aey -l4 -n $lv1 $vg
lvcreate -l4 -s -n $lv2 $vg/$lv1 lvcreate -l4 -s -n $lv2 $vg/$lv1
test $(lvs --noheadings $vg | wc -l) -eq 2 test "$(lvs --noheadings $vg | wc -l)" -eq 2
# should lvs -a display cow && real devices? (it doesn't) # should lvs -a display cow && real devices? (it doesn't)
test $(lvs -a --noheadings $vg | wc -l) -eq 2 test "$(lvs -a --noheadings $vg | wc -l)" -eq 2
dmsetup ls | grep "$PREFIX" | grep -v "LVMTEST.*pv." dmsetup ls | grep "$PREFIX" | grep -v "LVMTEST.*pv."
lvremove -f $vg/$lv2 lvremove -f $vg/$lv2
#COMM lvs -a displays mirror legs and log #COMM lvs -a displays mirror legs and log
lvcreate -aey -l2 --type mirror -m2 -n $lv3 $vg lvcreate -aey -l2 --type mirror -m2 -n $lv3 $vg
test $(lvs --noheadings $vg | wc -l) -eq 2 test "$(lvs --noheadings $vg | wc -l)" -eq 2
test $(lvs -a --noheadings $vg | wc -l) -eq 6 test "$(lvs -a --noheadings $vg | wc -l)" -eq 6
dmsetup ls | grep "$PREFIX" | grep -v "LVMTEST.*pv." dmsetup ls | grep "$PREFIX" | grep -v "LVMTEST.*pv."
# Check we parse /dev/mapper/vg-lv # Check we parse /dev/mapper/vg-lv

View File

@ -22,24 +22,24 @@ vgcreate $vg "$dev1" "$dev2"
# if wait_for_locks set, vgremove should wait for orphan lock # if wait_for_locks set, vgremove should wait for orphan lock
# flock process should have exited by the time first vgremove completes # flock process should have exited by the time first vgremove completes
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans sleep 10 & flock -w 5 "$TESTDIR/var/lock/lvm/P_orphans" sleep 10 &
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done while ! test -f "$TESTDIR/var/lock/lvm/P_orphans" ; do sleep .1 ; done
vgremove --config 'global { wait_for_locks = 1 }' $vg vgremove --config 'global { wait_for_locks = 1 }' $vg
not vgremove --config 'global { wait_for_locks = 1 }' $vg not vgremove --config 'global { wait_for_locks = 1 }' $vg
test ! -f $TESTDIR/var/lock/lvm/P_orphans test ! -f "$TESTDIR/var/lock/lvm/P_orphans"
# if wait_for_locks not set, vgremove should fail on non-blocking lock # if wait_for_locks not set, vgremove should fail on non-blocking lock
# we must wait for flock process at the end - vgremove won't wait # we must wait for flock process at the end - vgremove won't wait
vgcreate $vg "$dev1" "$dev2" vgcreate $vg "$dev1" "$dev2"
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans sleep 10 & flock -w 5 "$TESTDIR/var/lock/lvm/P_orphans" sleep 10 &
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done while ! test -f "$TESTDIR/var/lock/lvm/P_orphans" ; do sleep .1 ; done
flock_pid=`jobs -p` flock_pid=$(jobs -p)
not vgremove --config 'global { wait_for_locks = 0 }' $vg not vgremove --config 'global { wait_for_locks = 0 }' $vg
test -f $TESTDIR/var/lock/lvm/P_orphans # still running test -f "$TESTDIR/var/lock/lvm/P_orphans" # still running
kill $flock_pid kill "$flock_pid"
vgremove -ff $vg vgremove -ff $vg

View File

@ -27,7 +27,7 @@ lvcreate -l1 -n $lv2 $vg
mkfs.ext3 "$DM_DEV_DIR/$vg/$lv1" mkfs.ext3 "$DM_DEV_DIR/$vg/$lv1"
# Slowdown PV for resized LV # Slowdown PV for resized LV
aux delay_dev "$dev1" 50 50 $(get first_extent_sector "$dev1"): aux delay_dev "$dev1" 50 50 "$(get first_extent_sector "$dev1"):"
lvresize -L-5 -r $vg/$lv1 & lvresize -L-5 -r $vg/$lv1 &

View File

@ -23,7 +23,7 @@ aux prepare_loop 1000 -P || skip
test -f LOOP test -f LOOP
LOOP=$(< LOOP) LOOP=$(< LOOP)
echo "1 2" | sfdisk $LOOP echo "1 2" | sfdisk "$LOOP"
# wait for links # wait for links
aux udev_wait aux udev_wait
@ -35,8 +35,8 @@ test -e "${LOOP}p1"
aux extend_filter "a|$LOOP|" aux extend_filter "a|$LOOP|"
# creation should fail for 'partitioned' loop device # creation should fail for 'partitioned' loop device
not pvcreate -y $LOOP not pvcreate -y "$LOOP"
not vgcreate vg $LOOP not vgcreate vg "$LOOP"
aux teardown_devs aux teardown_devs
@ -46,7 +46,7 @@ test -f LOOP
LOOP=$(< LOOP) LOOP=$(< LOOP)
echo "1 2" | sfdisk $LOOP echo "1 2" | sfdisk "$LOOP"
# wait for links # wait for links
aux udev_wait aux udev_wait
@ -58,6 +58,6 @@ test ! -e "${LOOP}p1"
aux extend_filter "a|$LOOP|" aux extend_filter "a|$LOOP|"
# creation should pass for 'non-partitioned' loop device # creation should pass for 'non-partitioned' loop device
pvcreate -y $LOOP pvcreate -y "$LOOP"
vgcreate vg $LOOP vgcreate vg "$LOOP"

View File

@ -34,11 +34,11 @@ function _check_raid
local devs=$* local devs=$*
aux wait_for_sync $vg $lv aux wait_for_sync $vg $lv
aux disable_dev --error --silent $devs aux disable_dev --error --silent "$devs"
mkfs.ext4 "$DM_DEV_DIR/$vg/$lv" mkfs.ext4 "$DM_DEV_DIR/$vg/$lv"
fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv" fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv"
check raid_leg_status $vg $lv "$fail" check raid_leg_status $vg $lv "$fail"
aux enable_dev --silent $devs aux enable_dev --silent "$devs"
lvs -a -o +devices $vg | tee out lvs -a -o +devices $vg | tee out
not grep unknown out not grep unknown out
lvchange --refresh $vg/$lv lvchange --refresh $vg/$lv
@ -51,19 +51,19 @@ function _check_raid
# raid1 with transiently failing devices # raid1 with transiently failing devices
lv=4way lv=4way
lvcreate -aey --type raid1 -m 3 --ignoremonitoring -L 1 -n $lv $vg lvcreate -aey --type raid1 -m 3 --ignoremonitoring -L 1 -n $lv $vg
_check_raid $vg $lv "ADAD" "AAAA" $dev2 $dev4 _check_raid $vg $lv "ADAD" "AAAA" "$dev2" "$dev4"
lvremove -y $vg/$lv lvremove -y $vg/$lv
# raid6 with transiently failing devices # raid6 with transiently failing devices
lv=6way lv=6way
lvcreate -aey --type raid6 -i 4 --ignoremonitoring -L 1 -n $lv $vg lvcreate -aey --type raid6 -i 4 --ignoremonitoring -L 1 -n $lv $vg
_check_raid $vg $lv "ADADAA" "AAAAAA" $dev2 $dev4 _check_raid $vg $lv "ADADAA" "AAAAAA" "$dev2" "$dev4"
lvremove -y $vg/$lv lvremove -y $vg/$lv
# raid10 with transiently failing devices # raid10 with transiently failing devices
lv=6way lv=6way
lvcreate -aey --type raid10 -i 3 -m 1 --ignoremonitoring -L 1 -n $lv $vg lvcreate -aey --type raid10 -i 3 -m 1 --ignoremonitoring -L 1 -n $lv $vg
_check_raid $vg $lv "ADADDA" "AAAAAA" $dev2 $dev4 $dev5 _check_raid $vg $lv "ADADDA" "AAAAAA" "$dev2" "$dev4" "$dev5"
lvremove -y $vg/$lv lvremove -y $vg/$lv
vgremove -f $vg vgremove -f $vg

View File

@ -145,7 +145,7 @@ run_syncaction_check() {
local lv=${2}${THIN_POSTFIX} local lv=${2}${THIN_POSTFIX}
printf "#\n#\n#\n# %s/%s (%s): run_syncaction_check\n#\n#\n#\n" \ printf "#\n#\n#\n# %s/%s (%s): run_syncaction_check\n#\n#\n#\n" \
$vg $lv $(get lv_field $vg/$lv segtype -a) $vg $lv "$(get lv_field "$vg/$lv" segtype -a)"
aux wait_for_sync $vg $lv aux wait_for_sync $vg $lv
device=$(get lv_devices $vg/${lv}_rimage_1) device=$(get lv_devices $vg/${lv}_rimage_1)
@ -203,7 +203,7 @@ run_refresh_check() {
local lv=${2}${THIN_POSTFIX} local lv=${2}${THIN_POSTFIX}
printf "#\n#\n#\n# %s/%s (%s): run_refresh_check\n#\n#\n#\n" \ printf "#\n#\n#\n# %s/%s (%s): run_refresh_check\n#\n#\n#\n" \
$vg $lv $(get lv_field $vg/$lv segtype -a) $vg $lv "$(get lv_field $vg/$lv segtype -a)"
aux wait_for_sync $vg $lv aux wait_for_sync $vg $lv
@ -249,7 +249,7 @@ run_recovery_rate_check() {
local lv=${2}${THIN_POSTFIX} local lv=${2}${THIN_POSTFIX}
printf "#\n#\n#\n# %s/%s (%s): run_recovery_rate_check\n#\n#\n#\n" \ printf "#\n#\n#\n# %s/%s (%s): run_recovery_rate_check\n#\n#\n#\n" \
$vg $lv $(get lv_field $vg/$lv segtype -a) $vg $lv "$(get lv_field $vg/$lv segtype -a)"
lvchange --minrecoveryrate 50 $vg/$lv lvchange --minrecoveryrate 50 $vg/$lv
lvchange --maxrecoveryrate 100 $vg/$lv lvchange --maxrecoveryrate 100 $vg/$lv

View File

@ -19,9 +19,9 @@ aux have_raid 1 3 5 || skip
aux prepare_vg 4 aux prepare_vg 4
for d in $dev1 $dev2 $dev3 $dev4 for d in "$dev1" "$dev2" "$dev3" "$dev4"
do do
aux delay_dev $d 0 20 $(get first_extent_sector "$d") aux delay_dev "$d" 0 20 "$(get first_extent_sector "$d")"
done done
# #
@ -30,13 +30,13 @@ done
# Create 4-way raid1 LV # Create 4-way raid1 LV
lvcreate -aey --ty raid1 -m 3 -Zn -L16M -n $lv1 $vg lvcreate -aey --ty raid1 -m 3 -Zn -L16M -n $lv1 $vg
not lvchange -y --writemostly $dev1 $vg/$lv1 not lvchange -y --writemostly "$dev1" "$vg/$lv1"
check lv_field $vg/$lv1 segtype "raid1" check lv_field $vg/$lv1 segtype "raid1"
check lv_field $vg/$lv1 stripes 4 check lv_field $vg/$lv1 stripes 4
check lv_attr_bit health $vg/${lv1}_rimage_0 "-" check lv_attr_bit health $vg/${lv1}_rimage_0 "-"
aux enable_dev $(< DEVICES) aux enable_dev $(< DEVICES)
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
lvchange -y --writemostly $dev1 $vg/$lv1 lvchange -y --writemostly "$dev1" "$vg/$lv1"
check lv_attr_bit health $vg/${lv1}_rimage_0 "w" check lv_attr_bit health $vg/${lv1}_rimage_0 "w"
vgremove -ff $vg vgremove -ff $vg

View File

@ -31,7 +31,7 @@ _sync() {
# Delay legs so that rebuilding status characters can be read # Delay legs so that rebuilding status characters can be read
for d in $(< DEVICES) for d in $(< DEVICES)
do do
aux delay_dev "$d" 0 50 $(get first_extent_sector "$d") aux delay_dev "$d" 0 50 "$(get first_extent_sector "$d")"
done done
# rhbz 1064592 # rhbz 1064592

View File

@ -29,7 +29,7 @@ lvcreate -L10M -T $vg/pool
# tests for checking thin-pool discard passdown are skipped # tests for checking thin-pool discard passdown are skipped
pvmajor=$(get pv_field "$dev1" major) pvmajor=$(get pv_field "$dev1" major)
pvminor=$(get pv_field "$dev1" minor) pvminor=$(get pv_field "$dev1" minor)
test "$(< /sys/dev/block/$pvmajor\:$pvminor/queue/discard_granularity)" -ne "0" || \ test "$(< "/sys/dev/block/$pvmajor\:$pvminor/queue/discard_granularity")" -ne 0 || \
no_discard=1 no_discard=1
# #

View File

@ -37,7 +37,7 @@ done
# Delay dev to ensure we have some time to 'capture' interrupt in flush # Delay dev to ensure we have some time to 'capture' interrupt in flush
aux delay_dev "$dev1" 0 500 $(get first_extent_sector "$dev1"): aux delay_dev "$dev1" 0 500 "$(get first_extent_sector "$dev1"):"
lvdisplay --maps $vg lvdisplay --maps $vg
sync sync

View File

@ -28,7 +28,7 @@ lvcreate -L1T -n cpool $vg
lvconvert -y --type cache-pool $vg/cpool lvconvert -y --type cache-pool $vg/cpool
# Check chunk size in sectors is more then 512K # Check chunk size in sectors is more then 512K
test $(get lv_field $vg/cpool chunk_size --units s --nosuffix) -gt 1000 test "$(get lv_field "$vg/cpool" chunk_size --units s --nosuffix)" -gt 1000
lvcreate -L1M -n $lv1 $vg lvcreate -L1M -n $lv1 $vg

View File

@ -234,7 +234,7 @@ lvremove -ff $vg
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# "rhbz440405: lvconvert -m0 incorrectly fails if all PEs allocated" # "rhbz440405: lvconvert -m0 incorrectly fails if all PEs allocated"
lvcreate -aey -l$(pvs --noheadings -ope_count "$dev1") --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE" lvcreate -aey -l "$(get pv_field "$dev1" pe_count)" --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
lvconvert -m0 $vg/$lv1 "$dev1" lvconvert -m0 $vg/$lv1 "$dev1"
check linear $vg $lv1 check linear $vg $lv1

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
####################################################################### #######################################################################
# This series of tests is meant to validate the correctness of # This series of tests is meant to validate the correctness of
# 'dmsetup status' for RAID LVs - especially during various sync action # 'dmsetup status' for RAID LVs - especially during various sync action
@ -20,108 +21,108 @@ vgcreate -s 2m $vg $(cat DEVICES)
########################################### ###########################################
# Upconverted RAID1 should never have all 'a's in status output # Upconverted RAID1 should never have all 'a's in status output
########################################### ###########################################
aux delay_dev $dev2 0 50 aux delay_dev "$dev2" 0 50
lvcreate -aey -l 2 -n $lv1 $vg $dev1 lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert --type raid1 -y -m 1 $vg/$lv1 $dev2 lvconvert --type raid1 -y -m 1 $vg/$lv1 "$dev2"
while ! check in_sync $vg $lv1; do while ! check in_sync $vg $lv1; do
a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1" a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
[ ${a[5]} != "aa" ] [ "${a[5]}" != "aa" ]
sleep .1 sleep .1
done done
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
# Upconverted RAID1 should not be at 100% right after upconvert # Upconverted RAID1 should not be at 100% right after upconvert
########################################### ###########################################
aux delay_dev $dev2 0 50 aux delay_dev "$dev2" 0 50
lvcreate -aey -l 2 -n $lv1 $vg $dev1 lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert --type raid1 -y -m 1 $vg/$lv1 $dev2 lvconvert --type raid1 -y -m 1 $vg/$lv1 "$dev2"
a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1" a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo ${a[6]} | sed s:/:' ':) ) b=( $(echo "${a[6]}" | sed s:/:' ':) )
[ ${b[0]} -ne ${b[1]} ] [ "${b[0]}" -ne "${b[1]}" ]
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
# Catch anything suspicious with linear -> RAID1 upconvert # Catch anything suspicious with linear -> RAID1 upconvert
########################################### ###########################################
aux delay_dev $dev2 0 50 aux delay_dev "$dev2" 0 50
lvcreate -aey -l 2 -n $lv1 $vg $dev1 lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert --type raid1 -y -m 1 $vg/$lv1 $dev2 lvconvert --type raid1 -y -m 1 $vg/$lv1 "$dev2"
while true; do while true; do
a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1" a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo ${a[6]} | sed s:/:' ':) ) b=( $(echo "${a[6]}" | sed s:/:' ':) )
if [ ${b[0]} -ne ${b[1]} ]; then if [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("recover" in this case) is not # If the sync operation ("recover" in this case) is not
# finished, then it better be as follows: # finished, then it better be as follows:
[ ${a[5]} = "Aa" ] [ "${a[5]}" = "Aa" ]
[ ${a[7]} = "recover" ] [ "${a[7]}" = "recover" ]
else else
# Tough to tell the INVALID case, # Tough to tell the INVALID case,
# Before starting sync thread: "Aa X/X recover" # Before starting sync thread: "Aa X/X recover"
# from the valid case, # from the valid case,
# Just finished sync thread: "Aa X/X recover" # Just finished sync thread: "Aa X/X recover"
# We'll just put "should" for now # We'll just put "should" for now
should [ ${a[5]} = "AA" ] should [ "${a[5]}" = "AA" ]
should [ ${a[7]} = "idle" ] should [ "${a[7]}" = "idle" ]
break break
fi fi
sleep .1 sleep .1
done done
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
# Catch anything suspicious with RAID1 2-way -> 3-way upconvert # Catch anything suspicious with RAID1 2-way -> 3-way upconvert
########################################### ###########################################
aux delay_dev $dev3 0 50 aux delay_dev "$dev3" 0 50
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg $dev1 $dev2 lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
lvconvert -y -m +1 $vg/$lv1 $dev3 lvconvert -y -m +1 $vg/$lv1 "$dev3"
while true; do while true; do
a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1" a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo ${a[6]} | sed s:/:' ':) ) b=( $(echo "${a[6]}" | sed s:/:' ':) )
if [ ${b[0]} -ne ${b[1]} ]; then if [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("recover" in this case) is not # If the sync operation ("recover" in this case) is not
# finished, then it better be as follows: # finished, then it better be as follows:
[ ${a[5]} = "AAa" ] [ "${a[5]}" = "AAa" ]
[ ${a[7]} = "recover" ] [ "${a[7]}" = "recover" ]
else else
# Tough to tell the INVALID case, # Tough to tell the INVALID case,
# Before starting sync thread: "Aa X/X recover" # Before starting sync thread: "Aa X/X recover"
# from the valid case, # from the valid case,
# Just finished sync thread: "Aa X/X recover" # Just finished sync thread: "Aa X/X recover"
# We'll just put "should" for now # We'll just put "should" for now
should [ ${a[5]} = "AAA" ] should [ "${a[5]}" = "AAA" ]
should [ ${a[7]} = "idle" ] should [ "${a[7]}" = "idle" ]
break break
fi fi
sleep .1 sleep .1
done done
aux enable_dev $dev3 aux enable_dev "$dev3"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
# Catch anything suspicious with RAID1 initial resync # Catch anything suspicious with RAID1 initial resync
########################################### ###########################################
aux delay_dev $dev2 0 50 aux delay_dev "$dev2" 0 50
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg $dev1 $dev2 lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
while true; do while true; do
a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1" a=( $(dmsetup status $vg-$lv1) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo ${a[6]} | sed s:/:' ':) ) b=( $(echo "${a[6]}" | sed s:/:' ':) )
if [ ${b[0]} -ne ${b[1]} ]; then if [ "${b[0]}" -ne "${b[1]}" ]; then
# If the sync operation ("resync" in this case) is not # If the sync operation ("resync" in this case) is not
# finished, then it better be as follows: # finished, then it better be as follows:
[ ${a[5]} = "aa" ] [ "${a[5]}" = "aa" ]
[ ${a[7]} = "resync" ] [ "${a[7]}" = "resync" ]
else else
should [ ${a[5]} = "AA" ] should [ "${a[5]}" = "AA" ]
should [ ${a[7]} = "idle" ] should [ "${a[7]}" = "idle" ]
break break
fi fi
sleep .1 sleep .1
done done
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
vgremove -ff $vg vgremove -ff $vg

View File

@ -23,7 +23,7 @@ get_image_pvs() {
local images local images
images=`dmsetup ls | grep ${1}-${2}_.image_.* | cut -f1 | sed -e s:-:/:` images=`dmsetup ls | grep ${1}-${2}_.image_.* | cut -f1 | sed -e s:-:/:`
lvs --noheadings -a -o devices $images | sed s/\(.\)// lvs --noheadings -a -o devices "$images" | sed s/\(.\)//
} }
######################################################## ########################################################
@ -227,14 +227,14 @@ done
# - don't allow removal of primary while syncing # - don't allow removal of primary while syncing
# - DO allow removal of secondaries while syncing # - DO allow removal of secondaries while syncing
########################################### ###########################################
aux delay_dev $dev2 0 100 aux delay_dev "$dev2" 0 100
lvcreate -aey -l 2 -n $lv1 $vg $dev1 lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert -y -m 1 $vg/$lv1 \ lvconvert -y -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "raid1" }' $dev2 --config 'global { mirror_segtype_default = "raid1" }' "$dev2"
lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r' lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
not lvconvert --yes -m 0 $vg/$lv1 $dev1 not lvconvert --yes -m 0 $vg/$lv1 "$dev1"
lvconvert --yes -m 0 $vg/$lv1 $dev2 lvconvert --yes -m 0 $vg/$lv1 "$dev2"
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
@ -242,11 +242,11 @@ lvremove -ff $vg
# - DO allow removal of primary while syncing # - DO allow removal of primary while syncing
# - DO allow removal of secondaries while syncing # - DO allow removal of secondaries while syncing
########################################### ###########################################
aux delay_dev $dev2 0 100 aux delay_dev "$dev2" 0 100
lvcreate --type raid1 -m 2 -aey -l 2 -n $lv1 $vg $dev1 $dev2 $dev3 lvcreate --type raid1 -m 2 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
lvconvert --yes -m 1 $vg/$lv1 $dev3 lvconvert --yes -m 1 $vg/$lv1 "$dev3"
lvconvert --yes -m 0 $vg/$lv1 $dev1 lvconvert --yes -m 0 $vg/$lv1 "$dev1"
aux enable_dev $dev2 aux enable_dev "$dev2"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
@ -254,17 +254,17 @@ lvremove -ff $vg
# - DO allow removal of one of primary sources # - DO allow removal of one of primary sources
# - Do not allow removal of all primary sources # - Do not allow removal of all primary sources
########################################### ###########################################
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg $dev1 $dev2 lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
aux delay_dev $dev3 0 100 aux delay_dev "$dev3" 0 100
lvconvert --yes -m +1 $vg/$lv1 $dev3 lvconvert --yes -m +1 $vg/$lv1 "$dev3"
# should allow 1st primary to be removed # should allow 1st primary to be removed
lvconvert --yes -m -1 $vg/$lv1 $dev1 lvconvert --yes -m -1 $vg/$lv1 "$dev1"
# should NOT allow last primary to be removed # should NOT allow last primary to be removed
not lvconvert --yes -m -1 $vg/$lv1 $dev2 not lvconvert --yes -m -1 $vg/$lv1 "$dev2"
# should allow non-primary to be removed # should allow non-primary to be removed
lvconvert --yes -m 0 $vg/$lv1 $dev3 lvconvert --yes -m 0 $vg/$lv1 "$dev3"
aux enable_dev $dev3 aux enable_dev "$dev3"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
@ -272,15 +272,15 @@ lvremove -ff $vg
# - Should allow removal of two devices, # - Should allow removal of two devices,
# as long as they aren't both primary # as long as they aren't both primary
########################################### ###########################################
lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg $dev1 $dev2 lvcreate --type raid1 -m 1 -aey -l 2 -n $lv1 $vg "$dev1" "$dev2"
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
aux delay_dev $dev3 0 100 aux delay_dev "$dev3" 0 100
lvconvert --yes -m +1 $vg/$lv1 $dev3 lvconvert --yes -m +1 $vg/$lv1 "$dev3"
# should NOT allow both primaries to be removed # should NOT allow both primaries to be removed
not lvconvert -m 0 $vg/$lv1 $dev1 $dev2 not lvconvert -m 0 $vg/$lv1 "$dev1" "$dev2"
# should allow primary + non-primary # should allow primary + non-primary
lvconvert --yes -m 0 $vg/$lv1 $dev1 $dev3 lvconvert --yes -m 0 $vg/$lv1 "$dev1" "$dev3"
aux enable_dev $dev3 aux enable_dev "$dev3"
lvremove -ff $vg lvremove -ff $vg
########################################### ###########################################
@ -289,25 +289,25 @@ lvremove -ff $vg
# RAID1: Replace up to n-1 devices - trying different combinations # RAID1: Replace up to n-1 devices - trying different combinations
# Test for 2-way to 4-way RAID1 LVs # Test for 2-way to 4-way RAID1 LVs
for i in {1..3}; do for i in {1..3}; do
lvcreate --type raid1 -m $i -l 2 -n $lv1 $vg lvcreate --type raid1 -m "$i" -l 2 -n $lv1 $vg
for j in $(seq $(($i + 1))); do # The number of devs to replace at once for j in $(seq $(( i + 1 ))); do # The number of devs to replace at once
for o in $(seq 0 $i); do # The offset into the device list for o in $(seq 0 $i); do # The offset into the device list
replace="" replace=""
devices=( $(get_image_pvs $vg $lv1) ) devices=( $(get_image_pvs $vg $lv1) )
for k in $(seq $j); do for k in $(seq "$j"); do
index=$((($k + $o) % ($i + 1))) index=$((($k + $o) % ($i + 1)))
replace="$replace --replace ${devices[$index]}" replace="$replace --replace ${devices[$index]}"
done done
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
if [ $j -ge $((i + 1)) ]; then if [ "$j" -ge $(( i + 1 )) ]; then
# Can't replace all at once. # Can't replace all at once.
not lvconvert $replace $vg/$lv1 not lvconvert "$replace" $vg/$lv1
else else
lvconvert $replace $vg/$lv1 lvconvert "$replace" $vg/$lv1
fi fi
done done
done done

View File

@ -44,16 +44,16 @@ done
# Can't replace adjacent devices # Can't replace adjacent devices
devices=( $(get_image_pvs $vg $lv1) ) devices=( $(get_image_pvs $vg $lv1) )
not lvconvert --replace ${devices[0]} --replace ${devices[1]} $vg/$lv1 not lvconvert --replace "${devices[0]}" --replace "${devices[1]}" $vg/$lv1
not lvconvert --replace ${devices[2]} --replace ${devices[3]} $vg/$lv1 not lvconvert --replace "${devices[2]}" --replace "${devices[3]}" $vg/$lv1
not lvconvert --replace ${devices[4]} --replace ${devices[5]} $vg/$lv1 not lvconvert --replace "${devices[4]}" --replace "${devices[5]}" $vg/$lv1
# Can replace non-adjacent devices # Can replace non-adjacent devices
for i in 0 1; do for i in 0 1; do
lvconvert \ lvconvert \
--replace ${devices[$i]} \ --replace "${devices[$i]}" \
--replace ${devices[$(($i + 2))]} \ --replace "${devices[$(( i + 2 ))]}" \
--replace ${devices[$(($i + 4))]} \ --replace "${devices[$(( i + 4 ))]}" \
$vg/$lv1 $vg/$lv1
aux wait_for_sync $vg $lv1 aux wait_for_sync $vg $lv1
done done

View File

@ -39,8 +39,8 @@ lvcreate -aey --type mirror -L10 --regionsize 1M -m1 -n $lv1 $vg "$dev1" "$dev2"
"$MKFS" "$DM_DEV_DIR/$vg/$lv1" "$MKFS" "$DM_DEV_DIR/$vg/$lv1"
mkdir "$MOUNT_DIR" mkdir "$MOUNT_DIR"
aux delay_dev "$dev2" 0 500 $(get first_extent_sector "$dev2"): aux delay_dev "$dev2" 0 500 "$(get first_extent_sector "$dev2"):"
aux delay_dev "$dev4" 0 500 $(get first_extent_sector "$dev4"): aux delay_dev "$dev4" 0 500 "$(get first_extent_sector "$dev4"):"
# #
# Enforce syncronization # Enforce syncronization
# ATM requires unmounted/unused LV?? # ATM requires unmounted/unused LV??

View File

@ -27,7 +27,7 @@ function delay
{ {
for d in $(< DEVICES) for d in $(< DEVICES)
do do
aux delay_dev "$d" 0 $1 $(get first_extent_sector "$d") aux delay_dev "$d" 0 $1 "$(get first_extent_sector "$d")"
done done
} }

View File

@ -34,7 +34,7 @@ aux lvmconf 'devices/issue_discards = 1'
# Delay PVs so that resynchronization doesn't fill too much space # Delay PVs so that resynchronization doesn't fill too much space
for device in $(< DEVICES) for device in $(< DEVICES)
do do
aux delay_dev "$device" 0 10 $(get first_extent_sector "$device") aux delay_dev "$device" 0 10 "$(get first_extent_sector "$device")"
done done
# bz837927 START # bz837927 START

View File

@ -35,7 +35,7 @@ _sync() {
# Delay 1st leg so that rebuilding status characters # Delay 1st leg so that rebuilding status characters
# can be read before resync finished too quick. # can be read before resync finished too quick.
aux delay_dev "$dev1" 0 100 $(get first_extent_sector "$dev1") aux delay_dev "$dev1" 0 100 "$(get first_extent_sector "$dev1")"
# raid0/raid0_meta don't support resynchronization # raid0/raid0_meta don't support resynchronization
for r in raid0 raid0_meta for r in raid0 raid0_meta

View File

@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
lv_devices() { lv_devices() {
test $3 -eq $(get lv_devices $1/$2 | wc -w) test "$3" -eq "$(get lv_devices "$1/$2" | wc -w)"
} }
######################################################## ########################################################
@ -120,7 +120,7 @@ EAT_SIZE=$(get lv_field $vg/eat_space size)
lvcreate --type raid1 -m 1 -l 100%FREE -an -Zn -n raid1 $vg "$dev1" "$dev2" lvcreate --type raid1 -m 1 -l 100%FREE -an -Zn -n raid1 $vg "$dev1" "$dev2"
check lv_field $vg/raid1 size "9.50m" check lv_field $vg/raid1 size "9.50m"
# Ensure image size is the same as the RAID1 size # Ensure image size is the same as the RAID1 size
check lv_field $vg/raid1 size $(get lv_field $vg/raid1_rimage_0 size -a) check lv_field $vg/raid1 size "$(get lv_field $vg/raid1_rimage_0 size -a)"
# Amount remaining in dev2 should equal the amount taken by 'lv' in dev1 # Amount remaining in dev2 should equal the amount taken by 'lv' in dev1
check pv_field "$dev2" pv_free "$EAT_SIZE" check pv_field "$dev2" pv_free "$EAT_SIZE"
lvremove -ff $vg/raid1 lvremove -ff $vg/raid1

View File

@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
lv_devices() { lv_devices() {
test $3 -eq $(get lv_devices $1/$2 | wc -w) test "$3" -eq "$(get lv_devices "$1/$2" | wc -w)"
} }
######################################################## ########################################################

View File

@ -22,8 +22,8 @@ check_lv_field_modules_()
mod=$1 mod=$1
shift shift
for d in $*; do for d in "$@"; do
check lv_field $vg/$d modules $mod check lv_field "$vg/$d" modules "$mod"
done done
} }

View File

@ -39,7 +39,7 @@ lvremove -f $vg/$lv
# 'lvextend computes necessary free space correctly - bz213552' # 'lvextend computes necessary free space correctly - bz213552'
vgsize=$(get vg_field $vg vg_extent_count) vgsize=$(get vg_field $vg vg_extent_count)
lvcreate -l $vgsize -n $lv $vg lvcreate -l $vgsize -n $lv $vg
lvreduce -f -l $(( $vgsize / 2 )) $vg/$lv lvreduce -f -l $(( vgsize / 2 )) $vg/$lv
lvextend -l $vgsize $vg/$lv lvextend -l $vgsize $vg/$lv
# 'Reset LV to original size' # 'Reset LV to original size'
@ -73,13 +73,13 @@ check pv_field "$dev2" pv_free "0"
# Thus, total size for the LV should be 18 * 4M = 72M # Thus, total size for the LV should be 18 * 4M = 72M
# #
# 'Reset LV to 12 extents, allocate every other 2 extents' # 'Reset LV to 12 extents, allocate every other 2 extents'
create_pvs=$(for i in $(seq 0 4 20); do echo -n "$dev1:$i-$(($i + 1)) "; done) create_pvs=$(for i in $(seq 0 4 20); do echo -n "$dev1:$i-$(( i + 1 )) "; done)
lvremove -f $vg/$lv lvremove -f $vg/$lv
lvcreate -l 12 -n $lv $vg $create_pvs lvcreate -l 12 -n $lv $vg $create_pvs
check lv_field $vg/$lv lv_size "48.00m" check lv_field $vg/$lv lv_size "48.00m"
# 'lvextend with partially allocated PVs and extents 100%PVS with PE ranges' # 'lvextend with partially allocated PVs and extents 100%PVS with PE ranges'
extend_pvs=$(for i in $(seq 0 6 18); do echo -n "$dev1:$i-$(($i + 2)) "; done) extend_pvs=$(for i in $(seq 0 6 18); do echo -n "$dev1:$i-$(( i + 2 )) "; done)
lvextend -l +100%PVS $vg/$lv $extend_pvs | tee out lvextend -l +100%PVS $vg/$lv $extend_pvs | tee out
grep "Logical volume $vg/$lv successfully resized" out grep "Logical volume $vg/$lv successfully resized" out
check lv_field $vg/$lv lv_size "72.00m" check lv_field $vg/$lv lv_size "72.00m"
@ -90,17 +90,17 @@ check lv_field $vg/$lv lv_size "72.00m"
# FIXME: test other segment fields such as seg_size, pvseg_start, pvseg_size # FIXME: test other segment fields such as seg_size, pvseg_start, pvseg_size
lvremove -f $vg/$lv lvremove -f $vg/$lv
pe_count=$(get pv_field "$dev1" pv_pe_count) pe_count=$(get pv_field "$dev1" pv_pe_count)
pe1=$(( $pe_count / 2 )) pe1=$(( pe_count / 2 ))
lvcreate -l $pe1 -n $lv $vg lvcreate -l $pe1 -n $lv $vg
pesize=$(get lv_field $vg/$lv vg_extent_size --units b --nosuffix) pesize=$(get lv_field $vg/$lv vg_extent_size --units b --nosuffix)
segsize=$(( $pe1 * $pesize / 1024 / 1024 ))m segsize=$(( pe1 * pesize / 1024 / 1024 ))m
check lv_field $vg/$lv seg_count "1" check lv_field $vg/$lv seg_count "1"
check lv_field $vg/$lv seg_start "0" check lv_field $vg/$lv seg_start "0"
check lv_field $vg/$lv seg_start_pe "0" check lv_field $vg/$lv seg_start_pe "0"
#check lv_field $vg/$lv seg_size $segsize #check lv_field $vg/$lv seg_size $segsize
lvextend -l +$(( $pe_count * 1 )) $vg/$lv lvextend -l +$(( pe_count * 1 )) $vg/$lv
check lv_field $vg/$lv seg_count "2" check lv_field $vg/$lv seg_count "2"
lvreduce -f -l -$(( $pe_count * 1 )) $vg/$lv lvreduce -f -l -$(( pe_count * 1 )) $vg/$lv
check lv_field $vg/$lv seg_count "1" check lv_field $vg/$lv seg_count "1"
# do not reduce to 0 extents # do not reduce to 0 extents

View File

@ -43,7 +43,7 @@ lvcreate -aey -L16M -n base $vg
lvcreate -s -L4M -n snap $vg/base lvcreate -s -L4M -n snap $vg/base
write_ 0 1000 write_ 0 1000
test 24 -eq $(percent_) test 24 -eq "$(percent_)"
lvchange --monitor y $vg/snap lvchange --monitor y $vg/snap
@ -52,9 +52,9 @@ pre=$(percent_)
# Normally the usage should be ~66% here, however on slower systems # Normally the usage should be ~66% here, however on slower systems
# dmeventd could be actually 'fast' enough to have COW already resized now # dmeventd could be actually 'fast' enough to have COW already resized now
# so mark test skipped if we are below 50% by now # so mark test skipped if we are below 50% by now
test $pre -gt 50 || skip test "$pre" -gt 50 || skip
wait_for_change_ $pre wait_for_change_ $pre
test $pre -gt $(percent_) test "$pre" -gt "$(percent_)"
# check that a second extension happens; we used to fail to extend when the # check that a second extension happens; we used to fail to extend when the
# utilisation ended up between THRESH and (THRESH + 10)... see RHBZ 754198 # utilisation ended up between THRESH and (THRESH + 10)... see RHBZ 754198
@ -63,8 +63,8 @@ test $pre -gt $(percent_)
write_ 2700 2000 write_ 2700 2000
pre=$(percent_) pre=$(percent_)
# Mark test as skipped if already resized... # Mark test as skipped if already resized...
test $pre -gt 70 || skip test "$pre" -gt 70 || skip
wait_for_change_ $pre wait_for_change_ $pre
test $pre -gt $(percent_) test "$pre" -gt "$(percent_)"
vgremove -f $vg vgremove -f $vg

View File

@ -42,11 +42,11 @@ mkdir mnt
write 1 4096 write 1 4096
pre=$(percent) pre=$(percent)
extend 50 extend 50
test $pre -eq $(percent) test "$pre" -eq "$(percent)"
write 2 4096 write 2 4096
pre=$(percent) pre=$(percent)
extend 50 extend 50
test $pre -gt $(percent) test "$pre" -gt "$(percent)"
vgremove -f $vg vgremove -f $vg

View File

@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
kill -0 $(< LOCAL_LVMETAD) || die "lvmetad is already dead" kill -0 "$(< LOCAL_LVMETAD)" || die "lvmetad is already dead"
lvmetad_timeout=3 lvmetad_timeout=3
@ -23,14 +23,14 @@ aux prepare_pvs 1
vgcreate $vg1 "$dev1" vgcreate $vg1 "$dev1"
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
aux prepare_lvmetad -t $lvmetad_timeout aux prepare_lvmetad -t $lvmetad_timeout
sleep $lvmetad_timeout sleep $lvmetad_timeout
# lvmetad should die after timeout, but give it some time to do so # lvmetad should die after timeout, but give it some time to do so
i=0 i=0
while kill -0 $(< LOCAL_LVMETAD) 2>/dev/null; do while kill -0 "$(< LOCAL_LVMETAD)" 2>/dev/null; do
test $i -ge $((lvmetad_timeout*10)) && die "lvmetad didn't shutdown with optional timeout: $lvmetad_timeout seconds" test $i -ge $((lvmetad_timeout*10)) && die "lvmetad didn't shutdown with optional timeout: $lvmetad_timeout seconds"
sleep .1 sleep .1
i=$((i+1)) i=$((i+1))
@ -39,9 +39,9 @@ done
aux prepare_lvmetad -t 0 aux prepare_lvmetad -t 0
sleep 1 sleep 1
# lvmetad must not die with -t 0 option # lvmetad must not die with -t 0 option
kill -0 $(< LOCAL_LVMETAD) || die "lvmetad died" kill -0 "$(< LOCAL_LVMETAD)" || die "lvmetad died"
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
aux prepare_lvmetad -t $lvmetad_timeout aux prepare_lvmetad -t $lvmetad_timeout
sleep 1 sleep 1
@ -52,6 +52,6 @@ sleep 1
vgs vgs
# check that connection to lvmetad resets the timeout # check that connection to lvmetad resets the timeout
kill -0 $(< LOCAL_LVMETAD) || die "lvmetad died too soon" kill -0 "$(< LOCAL_LVMETAD)" || die "lvmetad died too soon"
vgremove -ff $vg1 vgremove -ff $vg1

View File

@ -17,7 +17,7 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 2 aux prepare_devs 2
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
while test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket close while test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket close
test ! -e "$LVM_LVMETAD_PIDFILE" test ! -e "$LVM_LVMETAD_PIDFILE"

View File

@ -26,7 +26,7 @@ check active $vg1 $lv1
lvchange -an $vg1 lvchange -an $vg1
check inactive $vg1 $lv1 check inactive $vg1 $lv1
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
lvchange -ay $vg1 2>&1 | tee out lvchange -ay $vg1 2>&1 | tee out
grep "WARNING: Failed to connect" out grep "WARNING: Failed to connect" out

View File

@ -54,7 +54,7 @@ mkdir test_mnt
setup_merge_ $vg1 $lv1 setup_merge_ $vg1 $lv1
mount "$(lvdev_ $vg1 $lv1)" test_mnt mount "$(lvdev_ $vg1 $lv1)" test_mnt
lvconvert --merge $vg1/$(snap_lv_name_ $lv1) lvconvert --merge "$vg1/$(snap_lv_name_ "$lv1")"
umount test_mnt umount test_mnt
vgchange -an $vg1 vgchange -an $vg1
@ -63,7 +63,7 @@ pvscan --cache -aay "$dev1"
check active $vg1 $lv1 check active $vg1 $lv1
i=100 i=100
while ! check lv_not_exists $vg1/$(snap_lv_name_ $lv1); do while ! check lv_not_exists "$vg1/$(snap_lv_name_ "$lv1")"; do
test $i -lt 0 && fail "Background polling failed to remove merged snapshot LV" test $i -lt 0 && fail "Background polling failed to remove merged snapshot LV"
sleep .1 sleep .1
i=$((i-1)) i=$((i-1))

View File

@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
rm LOCAL_LVMETAD rm LOCAL_LVMETAD
aux prepare_devs 2 aux prepare_devs 2

View File

@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest . lib/inittest
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
rm LOCAL_LVMETAD rm LOCAL_LVMETAD
aux prepare_devs 2 aux prepare_devs 2

View File

@ -20,7 +20,7 @@ aux prepare_pvs 2
vgcreate $vg1 "$dev1" "$dev2" vgcreate $vg1 "$dev1" "$dev2"
vgs | grep $vg1 vgs | grep $vg1
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
aux prepare_lvmetad aux prepare_lvmetad
vgs | grep $vg1 vgs | grep $vg1

View File

@ -52,7 +52,7 @@ check inactive $vg1 $lv1
# lvmetad is configured and not running # lvmetad is configured and not running
# #
kill $(< LOCAL_LVMETAD) kill "$(< LOCAL_LVMETAD)"
lvchange -ay $vg1 2>&1 | tee out lvchange -ay $vg1 2>&1 | tee out
grep "WARNING: Failed to connect" out grep "WARNING: Failed to connect" out

View File

@ -73,9 +73,9 @@ check pv_field "$dev3" pe_start $pv_align
pvs --units k -o name,pe_start,vg_mda_size,vg_name $(cat DEVICES) pvs --units k -o name,pe_start,vg_mda_size,vg_name $(cat DEVICES)
# create backup and then restore $dev3 # create backup and then restore $dev3
vgcfgbackup -f $TESTDIR/bak-%s $vg vgcfgbackup -f "$TESTDIR/bak-%s" "$vg"
pvcreate -ff -y --restorefile $TESTDIR/bak-$vg --uuid $pv3_uuid "$dev3" pvcreate -ff -y --restorefile "$TESTDIR/bak-$vg" --uuid "$pv3_uuid" "$dev3"
vgcfgrestore -f $TESTDIR/bak-$vg $vg vgcfgrestore -f "$TESTDIR/bak-$vg" "$vg"
# verify pe_start of $dev3 # verify pe_start of $dev3
check pv_field "$dev3" pe_start $pv_align check pv_field "$dev3" pe_start $pv_align

View File

@ -45,19 +45,15 @@ lv_convert_lv_() {
} }
enable_devs() { enable_devs() {
aux enable_dev "$dev1" for i in "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" ; do
aux enable_dev "$dev2" aux enable_dev "$i"
aux enable_dev "$dev3" done
aux enable_dev "$dev4"
aux enable_dev "$dev5"
} }
delay_devs() { delay_devs() {
aux delay_dev "$dev1" 0 1000 $(get first_extent_sector "$dev1"): for i in "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" ; do
aux delay_dev "$dev2" 0 1000 $(get first_extent_sector "$dev2"): aux delay_dev "$i" 0 1000 "$(get first_extent_sector "$i"):"
aux delay_dev "$dev3" 0 1000 $(get first_extent_sector "$dev3"): done
aux delay_dev "$dev4" 0 1000 $(get first_extent_sector "$dev4"):
aux delay_dev "$dev5" 0 1000 $(get first_extent_sector "$dev5"):
} }
# --------------------------------------------------------------------- # ---------------------------------------------------------------------

View File

@ -41,17 +41,17 @@ check pv_field "$dev1" pv_allocatable "allocatable"
check pv_field "$dev2" pv_allocatable "allocatable" check pv_field "$dev2" pv_allocatable "allocatable"
not grep WARNING out not grep WARNING out
UUID1=$(pvs --noheadings -o uuid $dev1 | xargs) UUID1=$(get pv_field "$dev1" uuid)
UUID2=$(pvs --noheadings -o uuid $dev2 | xargs) UUID2=$(get pv_field "$dev2" uuid)
SIZE1=$(pvs --noheadings -o dev_size $dev1) SIZE1=$(get pv_field "$dev1" dev_size)
SIZE2=$(pvs --noheadings -o dev_size $dev2) SIZE2=$(get pv_field "$dev2" dev_size)
MINOR1=$(pvs --noheadings -o minor $dev1) MINOR1=$(get pv_field "$dev1" minor)
MINOR2=$(pvs --noheadings -o minor $dev2) MINOR2=$(get pv_field "$dev2" minor)
check pv_field "$dev1" dev_size $SIZE1 check pv_field "$dev1" dev_size "$SIZE1"
check pv_field "$dev2" dev_size $SIZE2 check pv_field "$dev2" dev_size "$SIZE2"
# Copy dev1 over dev2. # Copy dev1 over dev2.
dd if="$dev1" of="$dev2" bs=1M iflag=direct oflag=direct,sync dd if="$dev1" of="$dev2" bs=1M iflag=direct oflag=direct,sync
@ -65,8 +65,8 @@ grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
# Don't know yet if dev1 or dev2 is preferred, so count just one is. # Don't know yet if dev1 or dev2 is preferred, so count just one is.
test $(grep $vg1 main | wc -l) -eq 1 test "$(grep -c "$vg1" main)" -eq 1
test $(grep $UUID1 main | wc -l) -eq 1 test "$(grep -c "$UUID1" main)" -eq 1
not grep duplicate main not grep duplicate main
not grep $vg2 main not grep $vg2 main
not grep $UUID2 main not grep $UUID2 main
@ -75,18 +75,18 @@ grep "was already found on" warn
grep "prefers device" warn grep "prefers device" warn
# Find which is the preferred dev and which is the duplicate. # Find which is the preferred dev and which is the duplicate.
PV=$(pvs --noheadings -o name -S uuid=$UUID1) PV=$(pvs --noheadings -o name -S uuid="$UUID1" | xargs)
if [ "$PV" = "$dev1" ]; then if [ "$PV" = "$dev1" ]; then
DUP=$dev2 DUP=$dev2
else else
DUP=$dev1 DUP=$dev1
fi fi
echo PV is $PV echo "PV is $PV"
echo DUP is $DUP echo "DUP is $DUP"
grep $PV main grep "$PV" main
not grep $DUP main not grep "$DUP" main
# Repeat above checking preferred/dup in output # Repeat above checking preferred/dup in output
pvs 2>&1 | tee out pvs 2>&1 | tee out
@ -95,8 +95,8 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
grep $PV main grep "$PV" main
not grep $DUP main not grep "$DUP" main
# The duplicate dev is included in 'pvs -a' # The duplicate dev is included in 'pvs -a'
pvs -a -o+uuid,duplicate 2>&1 | tee out pvs -a -o+uuid,duplicate 2>&1 | tee out
@ -109,7 +109,7 @@ grep "$dev1" main
grep "$dev2" main grep "$dev2" main
grep $PV main grep $PV main
grep $DUP main grep $DUP main
test $(grep duplicate main | wc -l) -eq 1 test "$(grep -c duplicate main)" -eq 1
grep $DUP main | grep duplicate grep $DUP main | grep duplicate
not grep $vg2 main not grep $vg2 main
not grep $UUID2 main not grep $UUID2 main
@ -133,8 +133,8 @@ grep -v WARNING out > main || true
grep "$dev1" main grep "$dev1" main
not grep "$dev2" main not grep "$dev2" main
grep $UUID1 main grep "$UUID1" main
grep $vg1 main grep "$vg1" main
grep "was already found on" warn grep "was already found on" warn
grep "prefers device" warn grep "prefers device" warn
@ -146,8 +146,8 @@ grep -v WARNING out > main || true
grep "$dev2" main grep "$dev2" main
not grep "$dev1" main not grep "$dev1" main
grep $UUID1 main grep "$UUID1" main
grep $vg1 main grep "$vg1" main
grep "was already found on" warn grep "was already found on" warn
grep "prefers device" warn grep "prefers device" warn
@ -163,7 +163,7 @@ grep "$dev1" main | grep $vg1
grep "$dev2" main | grep $vg1 grep "$dev2" main | grep $vg1
grep "$dev1" main | grep $UUID1 grep "$dev1" main | grep $UUID1
grep "$dev2" main | grep $UUID1 grep "$dev2" main | grep $UUID1
test $(grep duplicate main | wc -l) -eq 1 test "$(grep -c duplicate main)" -eq 1
grep $DUP main | grep duplicate grep $DUP main | grep duplicate
# #
@ -181,11 +181,11 @@ rm out1 out2 main1 main2 || true
check pv_field "$dev1" pv_in_use "used" check pv_field "$dev1" pv_in_use "used"
check pv_field "$dev2" pv_in_use "used" check pv_field "$dev2" pv_in_use "used"
check pv_field $PV pv_allocatable "allocatable" check pv_field "$PV" pv_allocatable "allocatable"
check pv_field $DUP pv_allocatable "" check pv_field "$DUP" pv_allocatable ""
check pv_field $PV pv_duplicate "" check pv_field "$PV" pv_duplicate ""
check pv_field $DUP pv_duplicate "duplicate" check pv_field "$DUP" pv_duplicate "duplicate"
pvs --noheadings -o name,pv_allocatable "$dev1" "$dev2" 2>&1 | tee out pvs --noheadings -o name,pv_allocatable "$dev1" "$dev2" 2>&1 | tee out
@ -193,11 +193,11 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
grep $PV main grep "$PV" main
grep $DUP main grep "$DUP" main
grep $dev1 main grep "$dev1" main
grep $dev2 main grep "$dev2" main
test $(grep allocatable main | wc -l) -eq 1 test "$(grep -c allocatable main)" -eq 1
pvs --noheadings -o name,pv_duplicate "$dev1" "$dev2" 2>&1 | tee out pvs --noheadings -o name,pv_duplicate "$dev1" "$dev2" 2>&1 | tee out
@ -205,11 +205,11 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
grep $PV main grep "$PV" main
grep $DUP main grep "$DUP" main
grep $dev1 main grep "$dev1" main
grep $dev2 main grep "$dev2" main
test $(grep duplicate main | wc -l) -eq 1 test "$(grep -c duplicate main)" -eq 1
# #
# A filter can be used to show only one. # A filter can be used to show only one.
@ -221,8 +221,8 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
not grep $dev1 main not grep "$dev1" main
grep $dev2 main grep "$dev2" main
not grep "was already found on" warn not grep "was already found on" warn
not grep "prefers device" warn not grep "prefers device" warn
@ -234,19 +234,19 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
grep $dev1 main grep "$dev1" main
not grep $dev2 main not grep "$dev2" main
not grep "was already found on" warn not grep "was already found on" warn
not grep "prefers device" warn not grep "prefers device" warn
# PV size and minor is still reported correctly for each. # PV size and minor is still reported correctly for each.
check pv_field "$dev1" dev_size $SIZE1 check pv_field "$dev1" dev_size "$SIZE1"
check pv_field "$dev2" dev_size $SIZE2 check pv_field "$dev2" dev_size "$SIZE2"
check pv_field "$dev1" minor $MINOR1 check pv_field "$dev1" minor "$MINOR1"
check pv_field "$dev2" minor $MINOR2 check pv_field "$dev2" minor "$MINOR2"
# With allow_changes_with_duplicate_pvs=0, a VG with duplicate devs # With allow_changes_with_duplicate_pvs=0, a VG with duplicate devs
# cannot be modified or activated. # cannot be modified or activated.
@ -277,14 +277,14 @@ pvcreate "$dev3"
pvcreate "$dev4" pvcreate "$dev4"
pvresize --setphysicalvolumesize 8m -y "$dev4" pvresize --setphysicalvolumesize 8m -y "$dev4"
UUID3=$(pvs --noheadings -o uuid $dev3 | xargs) UUID3=$(get pv_field "$dev3" uuid)
UUID4=$(pvs --noheadings -o uuid $dev4 | xargs) UUID4=$(get pv_field "$dev4" uuid)
SIZE3=$(pvs --noheadings -o dev_size $dev3) SIZE3=$(get pv_field "$dev3" dev_size)
SIZE4=$(pvs --noheadings -o dev_size $dev4) SIZE4=$(get pv_field "$dev4" dev_size)
check pv_field "$dev3" dev_size $SIZE3 check pv_field "$dev3" dev_size "$SIZE3"
check pv_field "$dev4" dev_size $SIZE4 check pv_field "$dev4" dev_size "$SIZE4"
pvs 2>&1 | tee out pvs 2>&1 | tee out
@ -302,8 +302,8 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
test $(grep $UUID3 main | wc -l) -eq 1 test "$(grep -c "$UUID3" main)" -eq 1
not grep $UUID4 main not grep "$UUID4" main
grep "was already found on" warn grep "was already found on" warn
grep "prefers device" warn grep "prefers device" warn
@ -316,7 +316,7 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
test $(grep $UUID3 main | wc -l) -eq 2 test "$(grep -c "$UUID3" main)" -eq 2
grep "$dev3" main grep "$dev3" main
grep "$dev4" main grep "$dev4" main
@ -367,8 +367,8 @@ grep "prefers device" warn
# Same sizes shown. # Same sizes shown.
check pv_field "$dev3" dev_size $SIZE3 check pv_field "$dev3" dev_size "$SIZE3"
check pv_field "$dev4" dev_size $SIZE4 check pv_field "$dev4" dev_size "$SIZE4"
# Verify that devs being used by an active LV are # Verify that devs being used by an active LV are
# preferred over duplicates that are not used by an LV. # preferred over duplicates that are not used by an LV.
@ -377,7 +377,7 @@ dd if=/dev/zero of="$dev3" bs=1M oflag=direct,sync || true
dd if=/dev/zero of="$dev4" bs=1M oflag=direct,sync || true dd if=/dev/zero of="$dev4" bs=1M oflag=direct,sync || true
pvscan --cache pvscan --cache
vgcreate $vg2 $dev3 $dev4 vgcreate "$vg2" "$dev3" "$dev4"
lvcreate -l1 -n $lv1 $vg2 "$dev3" lvcreate -l1 -n $lv1 $vg2 "$dev3"
lvcreate -l1 -n $lv2 $vg2 "$dev4" lvcreate -l1 -n $lv2 $vg2 "$dev4"
@ -410,7 +410,7 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
test $(grep duplicate main | wc -l) -eq 2 test "$(grep -c duplicate main)" -eq 2
grep "$dev3" main grep "$dev3" main
grep "$dev4" main grep "$dev4" main
grep "$dev5" main grep "$dev5" main
@ -427,7 +427,7 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
test $(grep duplicate main | wc -l) -eq 2 test "$(grep -c duplicate main)" -eq 2
grep "$dev3" main grep "$dev3" main
grep "$dev4" main grep "$dev4" main
grep "$dev5" main grep "$dev5" main
@ -484,7 +484,7 @@ rm warn main || true
grep WARNING out > warn || true grep WARNING out > warn || true
grep -v WARNING out > main || true grep -v WARNING out > main || true
test $(grep duplicate main | wc -l) -eq 2 test "$(grep -c duplicate main)" -eq 2
grep "$dev3" main grep "$dev3" main
grep "$dev4" main grep "$dev4" main
grep "$dev5" main grep "$dev5" main
@ -502,4 +502,3 @@ pvscan --cache
lvremove -y $vg2/$lv1 lvremove -y $vg2/$lv1
lvremove -y $vg2/$lv2 lvremove -y $vg2/$lv2
vgremove $vg2 vgremove $vg2

View File

@ -20,15 +20,15 @@ aux lvmconf 'metadata/check_pv_device_sizes = 1'
CHECK_MSG="smaller than corresponding PV size" CHECK_MSG="smaller than corresponding PV size"
vgcreate $vg $dev1 2>err vgcreate "$vg" "$dev1" 2>err
not grep "$CHECK_MSG" err not grep "$CHECK_MSG" err
pvs 2>err pvs 2>err
not grep "$CHECK_MSG" err not grep "$CHECK_MSG" err
vgremove -ff $vg vgremove -ff $vg
# set PV size to 2x dev size # set PV size to 2x dev size
pvcreate --yes --setphysicalvolumesize 16m $dev1 pvcreate --yes --setphysicalvolumesize 16m "$dev1"
vgcreate $vg $dev1 2>err vgcreate "$vg" "$dev1" 2>err
grep "$CHECK_MSG" err grep "$CHECK_MSG" err
pvs 2>err pvs 2>err
grep "$CHECK_MSG" err grep "$CHECK_MSG" err
@ -36,8 +36,8 @@ vgremove -ff $vg
# should be quiet if requested # should be quiet if requested
aux lvmconf 'metadata/check_pv_device_sizes = 0' aux lvmconf 'metadata/check_pv_device_sizes = 0'
pvcreate --yes --setphysicalvolumesize 16m $dev1 pvcreate --yes --setphysicalvolumesize 16m "$dev1"
vgcreate $vg $dev1 2>err vgcreate "$vg" "$dev1" 2>err
not grep "$CHECK_MSG" err not grep "$CHECK_MSG" err
pvs 2>err pvs 2>err
not grep "$CHECK_MSG" err not grep "$CHECK_MSG" err

View File

@ -78,7 +78,7 @@ aux enable_dev "$dev1"
# causing LVM tools to not see the VG inconsistency and once # causing LVM tools to not see the VG inconsistency and once
# VG repair is always done, delete this line which removes # VG repair is always done, delete this line which removes
# persistent .cache as a workaround # persistent .cache as a workaround
rm -f $TESTDIR/etc/.cache rm -f "$TESTDIR/etc/.cache"
vgck $vg1 vgck $vg1
# check $dev1 does not contain the PV_EXT_FLAG anymore - it # check $dev1 does not contain the PV_EXT_FLAG anymore - it
@ -143,7 +143,7 @@ aux enable_dev "$dev1"
# causing LVM tools to not see the VG inconsistency and once # causing LVM tools to not see the VG inconsistency and once
# VG repair is always done, delete this line which removes # VG repair is always done, delete this line which removes
# persistent .cache as a workaround # persistent .cache as a workaround
rm -f $TESTDIR/etc/.cache rm -f "$TESTDIR/etc/.cache"
vgck $vg1 vgck $vg1
# check $dev1 does not contain the PV_EXT_FLAG anymore - it # check $dev1 does not contain the PV_EXT_FLAG anymore - it

View File

@ -45,16 +45,16 @@ grep "Bootloader area with data-aligned start must not exceed device size" err
pvremove -ff "$dev1" pvremove -ff "$dev1"
pvcreate --dataalignment 256k --bootloaderareasize 600k "$dev1" pvcreate --dataalignment 256k --bootloaderareasize 600k "$dev1"
vgcreate $vg "$dev1" vgcreate $vg "$dev1"
vgcfgbackup -f $TESTDIR/vg_with_ba_backup $vg vgcfgbackup -f "$TESTDIR/vg_with_ba_backup" "$vg"
pv_uuid=$(get pv_field "$dev1" pv_uuid) pv_uuid=$(get pv_field "$dev1" pv_uuid)
vgremove -ff $vg vgremove -ff $vg
pvremove -ff "$dev1" pvremove -ff "$dev1"
pvcreate --dataalignment 256k --restorefile $TESTDIR/vg_with_ba_backup --uuid "$pv_uuid" "$dev1" pvcreate --dataalignment 256k --restorefile "$TESTDIR/vg_with_ba_backup" --uuid "$pv_uuid" "$dev1"
check pv_field "$dev1" ba_start "262144" check pv_field "$dev1" ba_start "262144"
check pv_field "$dev1" ba_size "786432" check pv_field "$dev1" ba_size "786432"
check pv_field "$dev1" pe_start "1048576" check pv_field "$dev1" pe_start "1048576"
# error out when restoring the PV and trying to use overlapping bootloader area # error out when restoring the PV and trying to use overlapping bootloader area
pvremove -ff "$dev1" pvremove -ff "$dev1"
not pvcreate --restorefile $TESTDIR/vg_with_ba_backup --uuid "$pv_uuid" --bootloaderareasize 1m "$dev1" 2>err not pvcreate --restorefile "$TESTDIR/vg_with_ba_backup" --uuid "$pv_uuid" --bootloaderareasize 1m "$dev1" 2>err
grep "Bootloader area would overlap data area" err grep "Bootloader area would overlap data area" err

View File

@ -100,7 +100,7 @@ done
# pvcreate (lvm2) fails writing LVM label at sector 4 # pvcreate (lvm2) fails writing LVM label at sector 4
not pvcreate --labelsector 4 "$dev1" not pvcreate --labelsector 4 "$dev1"
backupfile=$PREFIX.mybackupfile backupfile="$PREFIX.mybackupfile"
uuid1=freddy-fred-fred-fred-fred-fred-freddy uuid1=freddy-fred-fred-fred-fred-fred-freddy
uuid2=freddy-fred-fred-fred-fred-fred-fredie uuid2=freddy-fred-fred-fred-fred-fred-fredie
bogusuuid=fred bogusuuid=fred
@ -116,47 +116,47 @@ pvcreate --norestorefile --uuid $uuid1 "$dev1"
not pvcreate --norestorefile --uuid $uuid1 "$dev2" not pvcreate --norestorefile --uuid $uuid1 "$dev2"
# pvcreate rejects non-existent file given with restorefile # pvcreate rejects non-existent file given with restorefile
not pvcreate --uuid $uuid1 --restorefile $backupfile "$dev1" not pvcreate --uuid $uuid1 --restorefile "$backupfile" "$dev1"
# pvcreate rejects restorefile with uuid not found in file # pvcreate rejects restorefile with uuid not found in file
pvcreate --norestorefile --uuid $uuid1 "$dev1" pvcreate --norestorefile --uuid $uuid1 "$dev1"
vgcfgbackup -f $backupfile vgcfgbackup -f "$backupfile"
not pvcreate --uuid $uuid2 --restorefile $backupfile "$dev2" not pvcreate --uuid $uuid2 --restorefile "$backupfile" "$dev2"
# vgcfgrestore of a VG containing a PV with zero PEs (bz #820116) # vgcfgrestore of a VG containing a PV with zero PEs (bz #820116)
# (use case: one PV in a VG used solely to keep metadata) # (use case: one PV in a VG used solely to keep metadata)
size_mb=$(($(blockdev --getsz "$dev1") / 2048)) size_mb=$(($(blockdev --getsz "$dev1") / 2048))
pvcreate --metadatasize $size_mb "$dev1" pvcreate --metadatasize $size_mb "$dev1"
vgcreate $vg1 "$dev1" vgcreate $vg1 "$dev1"
vgcfgbackup -f $backupfile vgcfgbackup -f "$backupfile"
vgcfgrestore -f $backupfile $vg1 vgcfgrestore -f "$backupfile" "$vg1"
vgremove -f $vg1 vgremove -f $vg1
pvremove -f "$dev1" pvremove -f "$dev1"
# pvcreate --restorefile should handle --dataalignment and --dataalignmentoffset # pvcreate --restorefile should handle --dataalignment and --dataalignmentoffset
# and check it's compatible with pe_start value being restored # and check it's compatible with pe_start value being restored
# X * dataalignment + dataalignmentoffset == pe_start # X * dataalignment + dataalignmentoffset == pe_start
pvcreate --norestorefile --uuid $uuid1 --dataalignment 600k --dataalignmentoffset 32k "$dev1" pvcreate --norestorefile --uuid "$uuid1" --dataalignment 600k --dataalignmentoffset 32k "$dev1"
vgcreate $vg1 "$dev1" vgcreate $vg1 "$dev1"
vgcfgbackup -f $backupfile $vg1 vgcfgbackup -f "$backupfile" "$vg1"
vgremove -ff $vg1 vgremove -ff $vg1
pvremove -ff "$dev1" pvremove -ff "$dev1"
# the dataalignment and dataalignmentoffset is ignored here since they're incompatible with pe_start # the dataalignment and dataalignmentoffset is ignored here since they're incompatible with pe_start
pvcreate --restorefile $backupfile --uuid $uuid1 --dataalignment 500k --dataalignmentoffset 10k "$dev1" 2> err pvcreate --restorefile "$backupfile" --uuid "$uuid1" --dataalignment 500k --dataalignmentoffset 10k "$dev1" 2> err
grep "incompatible with restored pe_start value" err grep "incompatible with restored pe_start value" err
# 300k is multiple of 600k so this should pass # 300k is multiple of 600k so this should pass
pvcreate --restorefile $backupfile --uui $uuid1 --dataalignment 300k --dataalignmentoffset 32k "$dev1" 2> err pvcreate --restorefile "$backupfile" --uui "$uuid1" --dataalignment 300k --dataalignmentoffset 32k "$dev1" 2> err
not grep "incompatible with restored pe_start value" err not grep "incompatible with restored pe_start value" err
rm -f $backupfile rm -f "$backupfile"
# pvcreate rejects non-existent uuid given with restorefile # pvcreate rejects non-existent uuid given with restorefile
not pvcreate --uuid $uuid1 --restorefile $backupfile "$dev1" not pvcreate --uuid "$uuid1" --restorefile "$backupfile" "$dev1"
# pvcreate rejects restorefile without uuid # pvcreate rejects restorefile without uuid
not pvcreate --restorefile $backupfile "$dev1" not pvcreate --restorefile "$backupfile" "$dev1"
# pvcreate rejects uuid restore with multiple volumes specified # pvcreate rejects uuid restore with multiple volumes specified
not pvcreate --uuid $uuid1 --restorefile $backupfile "$dev1" "$dev2" not pvcreate --uuid "$uuid1" --restorefile "$backupfile" "$dev1" "$dev2"
# pvcreate wipes swap signature when forced # pvcreate wipes swap signature when forced
dd if=/dev/zero of="$dev1" bs=1024 count=64 dd if=/dev/zero of="$dev1" bs=1024 count=64

View File

@ -29,8 +29,8 @@ pvcreate --metadatacopies 0 "$dev6"
vgextend $vg1 "$dev6" vgextend $vg1 "$dev6"
# Slowdown writes # Slowdown writes
aux delay_dev "$dev3" 0 800 $(get first_extent_sector "$dev3"): aux delay_dev "$dev3" 0 800 "$(get first_extent_sector "$dev3"):"
aux delay_dev "$dev6" 0 800 $(get first_extent_sector "$dev6"): aux delay_dev "$dev6" 0 800 "$(get first_extent_sector "$dev6"):"
for mode in "--atomic" "" ; for mode in "--atomic" "" ;
do do

View File

@ -22,7 +22,7 @@ pvcreate --metadatacopies 0 "$dev3"
vgextend $vg "$dev3" vgextend $vg "$dev3"
# Slowdown read/writes # Slowdown read/writes
aux delay_dev "$dev3" 0 800 $(get first_extent_sector "$dev3"): aux delay_dev "$dev3" 0 800 "$(get first_extent_sector "$dev3"):"
for mode in "--atomic" "" ; for mode in "--atomic" "" ;
do do

View File

@ -352,7 +352,7 @@ pvmove $mode "$dev1"
dmsetup create $vg-pvmove0 --notable dmsetup create $vg-pvmove0 --notable
not pvmove $mode -i 1 "$dev2" not pvmove $mode -i 1 "$dev2"
dmsetup info --noheadings -c -o suspended $vg-$lv1 dmsetup info --noheadings -c -o suspended $vg-$lv1
test $(dmsetup info --noheadings -c -o suspended $vg-$lv1) = "Active" test "$(dmsetup info --noheadings -c -o suspended "$vg-$lv1")" = "Active"
if dmsetup info $vg-pvmove0_mimage_0 > /dev/null; then if dmsetup info $vg-pvmove0_mimage_0 > /dev/null; then
dmsetup remove $vg-pvmove0 $vg-pvmove0_mimage_0 $vg-pvmove0_mimage_1 dmsetup remove $vg-pvmove0 $vg-pvmove0_mimage_0 $vg-pvmove0_mimage_1
else else

View File

@ -23,7 +23,7 @@ vgextend $vg "$dev3"
# Slowdown writes # Slowdown writes
# (FIXME: generates interesting race when not used) # (FIXME: generates interesting race when not used)
aux delay_dev "$dev3" 0 800 $(get first_extent_sector "$dev3"): aux delay_dev "$dev3" 0 800 "$(get first_extent_sector "$dev3"):"
test -e HAVE_DM_DELAY || skip test -e HAVE_DM_DELAY || skip
for mode in "--atomic" "" for mode in "--atomic" ""
@ -73,7 +73,7 @@ if test -e LOCAL_CLVMD ; then
# as clvmd starts to abort on internal errors on various # as clvmd starts to abort on internal errors on various
# errors, based on the fact pvmove is killed -9 # errors, based on the fact pvmove is killed -9
# Restart clvmd # Restart clvmd
kill $(< LOCAL_CLVMD) kill "$(< LOCAL_CLVMD)"
for i in $(seq 1 100) ; do for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow." test $i -eq 100 && die "Shutdown of clvmd is too slow."
pgrep clvmd || break pgrep clvmd || break

View File

@ -33,9 +33,9 @@ test_pvmove_resume() {
lvcreate -an -Zn -l30 -n $lv1 $vg lvcreate -an -Zn -l30 -n $lv1 $vg
lvcreate -an -Zn -l30 -n $lv1 $vg1 lvcreate -an -Zn -l30 -n $lv1 $vg1
aux delay_dev "$dev3" 0 1000 $(get first_extent_sector "$dev3"): aux delay_dev "$dev3" 0 1000 "$(get first_extent_sector "$dev3"):"
test -e HAVE_DM_DELAY || { lvremove -f $vg $vg1; return 0; } test -e HAVE_DM_DELAY || { lvremove -f $vg $vg1; return 0; }
aux delay_dev "$dev4" 0 1000 $(get first_extent_sector "$dev4"): aux delay_dev "$dev4" 0 1000 "$(get first_extent_sector "$dev4"):"
pvmove -i5 "$dev1" & pvmove -i5 "$dev1" &
PVMOVE=$! PVMOVE=$!
@ -69,7 +69,7 @@ test_pvmove_resume() {
# as clvmd starts to abort on internal errors on various # as clvmd starts to abort on internal errors on various
# errors, based on the fact pvmove is killed -9 # errors, based on the fact pvmove is killed -9
# Restart clvmd # Restart clvmd
kill $(< LOCAL_CLVMD) kill "$(< LOCAL_CLVMD)"
for i in $(seq 1 100) ; do for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow." test $i -eq 100 && die "Shutdown of clvmd is too slow."
test -e "$CLVMD_PIDFILE" || break test -e "$CLVMD_PIDFILE" || break
@ -116,7 +116,7 @@ lvchange_single() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq $1
fi fi
} }
@ -128,7 +128,7 @@ lvchange_all() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq $1
fi fi
} }
@ -141,7 +141,7 @@ vgchange_single() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq "$1"
fi fi
} }
@ -153,7 +153,7 @@ vgchange_all() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq "$1"
fi fi
} }
@ -167,7 +167,7 @@ pvmove_fg() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -192,7 +192,7 @@ pvmove_bg() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -212,7 +212,7 @@ pvmove_fg_single() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -238,7 +238,7 @@ pvmove_bg_single() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg1/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling

View File

@ -30,7 +30,7 @@ test_pvmove_resume() {
lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1" lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1"
lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1" lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1"
aux delay_dev "$dev2" 0 1000 $(get first_extent_sector "$dev2"): aux delay_dev "$dev2" 0 1000 "$(get first_extent_sector "$dev2"):"
pvmove -i5 "$dev1" & pvmove -i5 "$dev1" &
PVMOVE=$! PVMOVE=$!
@ -57,7 +57,7 @@ test_pvmove_resume() {
# as clvmd starts to abort on internal errors on various # as clvmd starts to abort on internal errors on various
# errors, based on the fact pvmove is killed -9 # errors, based on the fact pvmove is killed -9
# Restart clvmd # Restart clvmd
kill $(< LOCAL_CLVMD) kill "$(< LOCAL_CLVMD)"
for i in $(seq 1 100) ; do for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow." test $i -eq 100 && die "Shutdown of clvmd is too slow."
test -e "$CLVMD_PIDFILE" || break test -e "$CLVMD_PIDFILE" || break
@ -101,7 +101,7 @@ lvchange_all() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" || should false aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" || should false
elif test -e HAVE_DM_DELAY; then elif test -e HAVE_DM_DELAY; then
test $(aux count_processes_with_tag) -eq $1 || should false test "$(aux count_processes_with_tag)" -eq "$1" || should false
fi fi
} }
@ -112,7 +112,7 @@ vgchange_single() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
elif test -e HAVE_DM_DELAY; then elif test -e HAVE_DM_DELAY; then
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq "$1"
fi fi
} }
@ -125,7 +125,7 @@ pvmove_fg() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -145,7 +145,7 @@ pvmove_bg() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -163,7 +163,7 @@ pvmove_fg_single() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -183,7 +183,7 @@ pvmove_bg_single() {
aux lvmpolld_dump | tee lvmpolld_dump.txt aux lvmpolld_dump | tee lvmpolld_dump.txt
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling

View File

@ -33,9 +33,9 @@ test_pvmove_resume() {
# next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG) # next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG)
lvcreate -an -Zn -l30 -n $lv2 $vg "$dev3" lvcreate -an -Zn -l30 -n $lv2 $vg "$dev3"
aux delay_dev "$dev4" 0 250 $(get first_extent_sector "$dev4"): aux delay_dev "$dev4" 0 250 "$(get first_extent_sector "$dev4"):"
test -e HAVE_DM_DELAY || { lvremove -f $vg; return 0; } test -e HAVE_DM_DELAY || { lvremove -f $vg; return 0; }
aux delay_dev "$dev5" 0 250 $(get first_extent_sector "$dev5"): aux delay_dev "$dev5" 0 250 "$(get first_extent_sector "$dev5"):"
pvmove -i5 "$dev1" "$dev4" & pvmove -i5 "$dev1" "$dev4" &
PVMOVE=$! PVMOVE=$!
@ -69,7 +69,7 @@ test_pvmove_resume() {
# as clvmd starts to abort on internal errors on various # as clvmd starts to abort on internal errors on various
# errors, based on the fact pvmove is killed -9 # errors, based on the fact pvmove is killed -9
# Restart clvmd # Restart clvmd
kill $(< LOCAL_CLVMD) kill "$(< LOCAL_CLVMD)"
for i in $(seq 1 100) ; do for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow." test $i -eq 100 && die "Shutdown of clvmd is too slow."
test -e "$CLVMD_PIDFILE" || break test -e "$CLVMD_PIDFILE" || break
@ -117,7 +117,7 @@ lvchange_all() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq $1
fi fi
} }
@ -129,7 +129,7 @@ vgchange_single() {
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 1 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 1 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq $1 test "$(aux count_processes_with_tag)" -eq "$1"
fi fi
} }
@ -143,7 +143,7 @@ pvmove_fg() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -168,7 +168,7 @@ pvmove_bg() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -188,7 +188,7 @@ pvmove_fg_single() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling
@ -214,7 +214,7 @@ pvmove_bg_single() {
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove0"
aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1" aux check_lvmpolld_init_rq_count 0 "$vg/pvmove1"
else else
test $(aux count_processes_with_tag) -eq 0 test "$(aux count_processes_with_tag)" -eq 0
fi fi
# ...thus finish polling # ...thus finish polling

View File

@ -35,7 +35,7 @@ lvremove -ff $vg
blockdev --setra 768 "$dev1" blockdev --setra 768 "$dev1"
vgscan vgscan
lvcreate -n $lv -L4m $vg "$dev1" lvcreate -n $lv -L4m $vg "$dev1"
test $(blockdev --getra "$DM_DEV_DIR/$vg/$lv") -eq 768 test "$(blockdev --getra "$DM_DEV_DIR/$vg/$lv")" -eq 768
lvremove -ff $vg lvremove -ff $vg
# Check default, active/inactive values for read_ahead / kernel_read_ahead # Check default, active/inactive values for read_ahead / kernel_read_ahead

View File

@ -35,7 +35,7 @@ mkdir "$mntdir"
# Use remount-ro to avoid logging kernel WARNING # Use remount-ro to avoid logging kernel WARNING
mount -o errors=remount-ro "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir" mount -o errors=remount-ro "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 1 test "$(dmsetup info -c --noheadings -o open $vg-snap)" -eq 1
cat /proc/mounts | grep "$mntdir" cat /proc/mounts | grep "$mntdir"
@ -48,7 +48,7 @@ not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=4 conv=fdatasync
# removed from /proc/mounts, but still opened). # removed from /proc/mounts, but still opened).
for i in {1..100}; do for i in {1..100}; do
sleep .1 sleep .1
test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 0 && break test "$(dmsetup info -c --noheadings -o open $vg-snap)" -eq 0 && break
done done
cat /proc/mounts | not grep "$mntdir" cat /proc/mounts | not grep "$mntdir"

View File

@ -39,7 +39,7 @@ snap_and_merge() {
get lv_field $vg/$lv2 lv_attr | grep "Swi-a-s---" get lv_field $vg/$lv2 lv_attr | grep "Swi-a-s---"
kill $SLEEP_PID kill $SLEEP_PID
aux delay_dev "$dev1" 0 200 $(get first_extent_sector "$dev1"): aux delay_dev "$dev1" 0 200 "$(get first_extent_sector "$dev1"):"
lvchange --poll n --refresh $vg/$lv1 lvchange --poll n --refresh $vg/$lv1
dmsetup table dmsetup table
lvs -av -o+lv_merging,lv_merge_failed $vg lvs -av -o+lv_merging,lv_merge_failed $vg
@ -47,7 +47,7 @@ snap_and_merge() {
get lv_field $vg/$lv1 lv_attr | grep "Owi-a-" get lv_field $vg/$lv1 lv_attr | grep "Owi-a-"
sleep 1 sleep 1
check lv_attr_bit state $vg/$lv2 "a" check lv_attr_bit state $vg/$lv2 "a"
aux error_dev "$dev2" $(get first_extent_sector "$dev2"): aux error_dev "$dev2" "$(get first_extent_sector "$dev2"):"
aux enable_dev "$dev1" aux enable_dev "$dev1"
# delay to let snapshot merge 'discover' failing COW device # delay to let snapshot merge 'discover' failing COW device
sleep 1 sleep 1

View File

@ -23,7 +23,7 @@ lvdev_() {
} }
snap_lv_name_() { snap_lv_name_() {
echo ${1}_snap echo "${1}_snap"
} }
setup_merge_() { setup_merge_() {
@ -53,24 +53,24 @@ setup_merge_ $vg $lv1
# make sure lvconvert --merge requires explicit LV listing # make sure lvconvert --merge requires explicit LV listing
not lvconvert --merge not lvconvert --merge
lvconvert --merge $vg/$(snap_lv_name_ $lv1) lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
lvremove -f $vg/$lv1 lvremove -f $vg/$lv1
setup_merge_ $vg $lv1 setup_merge_ $vg $lv1
lvconvert --mergesnapshot $vg/$(snap_lv_name_ $lv1) lvconvert --mergesnapshot "$vg/$(snap_lv_name_ "$lv1")"
lvremove -f $vg/$lv1 lvremove -f $vg/$lv1
# test that an actively merging snapshot may not be removed # test that an actively merging snapshot may not be removed
setup_merge_ $vg $lv1 setup_merge_ $vg $lv1
lvconvert -i+100 --merge --background $vg/$(snap_lv_name_ $lv1) lvconvert -i+100 --merge --background "$vg/$(snap_lv_name_ "$lv1")"
not lvremove -f $vg/$(snap_lv_name_ $lv1) not lvremove -f "$vg/$(snap_lv_name_ "$lv1")"
lvremove -f $vg/$lv1 lvremove -f $vg/$lv1
# "onactivate merge" test # "onactivate merge" test
setup_merge_ $vg $lv1 setup_merge_ $vg $lv1
mount "$(lvdev_ $vg $lv1)" test_mnt mount "$(lvdev_ $vg $lv1)" test_mnt
lvconvert --merge $vg/$(snap_lv_name_ $lv1) lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
# -- refresh LV while FS is still mounted (merge must not start), # -- refresh LV while FS is still mounted (merge must not start),
# verify 'snapshot-origin' target is still being used # verify 'snapshot-origin' target is still being used
lvchange --refresh $vg/$lv1 lvchange --refresh $vg/$lv1
@ -91,7 +91,7 @@ lvremove -f $vg/$lv1
# to make sure preload of origin's metadata is _not_ performed # to make sure preload of origin's metadata is _not_ performed
setup_merge_ $vg $lv1 setup_merge_ $vg $lv1
mount "$(lvdev_ $vg $lv1)" test_mnt mount "$(lvdev_ $vg $lv1)" test_mnt
lvconvert --merge $vg/$(snap_lv_name_ $lv1) lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
# -- refresh LV while FS is still mounted (merge must not start), # -- refresh LV while FS is still mounted (merge must not start),
# verify 'snapshot-origin' target is still being used # verify 'snapshot-origin' target is still being used
lvchange --refresh $vg/$lv1 lvchange --refresh $vg/$lv1
@ -102,19 +102,19 @@ lvremove -f $vg/$lv1
# test multiple snapshot merge; tests copy out that is driven by merge # test multiple snapshot merge; tests copy out that is driven by merge
setup_merge_ $vg $lv1 1 setup_merge_ $vg $lv1 1
lvconvert --merge $vg/$(snap_lv_name_ $lv1) lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
lvremove -f $vg/$lv1 lvremove -f $vg/$lv1
# test merging multiple snapshots that share the same tag # test merging multiple snapshots that share the same tag
setup_merge_ $vg $lv1 setup_merge_ $vg $lv1
setup_merge_ $vg $lv2 setup_merge_ $vg $lv2
lvchange --addtag this_is_a_test $vg/$(snap_lv_name_ $lv1) lvchange --addtag this_is_a_test "$vg/$(snap_lv_name_ "$lv1")"
lvchange --addtag this_is_a_test $vg/$(snap_lv_name_ $lv2) lvchange --addtag this_is_a_test "$vg/$(snap_lv_name_ "$lv2")"
lvconvert --merge @this_is_a_test lvconvert --merge @this_is_a_test
lvs $vg | tee out lvs $vg | tee out
not grep $(snap_lv_name_ $lv1) out not grep "$(snap_lv_name_ "$lv1")" out
not grep $(snap_lv_name_ $lv2) out not grep "$(snap_lv_name_ "$lv2")" out
lvremove -f $vg/$lv1 $vg/$lv2 lvremove -f $vg/$lv1 $vg/$lv2
# FIXME following tests would need to poll merge progress, via periodic lvs? # FIXME following tests would need to poll merge progress, via periodic lvs?

View File

@ -31,7 +31,7 @@ cleanup_mounted_and_teardown()
is_lv_opened_() is_lv_opened_()
{ {
test $(get lv_field "$1" lv_device_open --binary) = "1" test "$(get lv_field "$1" lv_device_open --binary)" = 1
} }
# #
@ -49,12 +49,12 @@ cat <<- EOF >testcmd.sh
echo "Data: \$DMEVENTD_THIN_POOL_DATA" echo "Data: \$DMEVENTD_THIN_POOL_DATA"
echo "Metadata: \$DMEVENTD_THIN_POOL_METADATA" echo "Metadata: \$DMEVENTD_THIN_POOL_METADATA"
$TESTDIR/lib/lvextend --use-policies \$1 || { "$TESTDIR/lib/lvextend" --use-policies \$1 || {
umount "$mntdir" || true umount "$mntdir" || true
umount "$mntusedir" || true umount "$mntusedir" || true
return 0 return 0
} }
test \$($TESTDIR/lib/lvs -o selected -S "data_percent>95||metadata_percent>95" --noheadings \$1) -eq 0 || { test "\$($TESTDIR/lib/lvs -o selected -S "data_percent>95||metadata_percent>95" --noheadings \$1)" -eq 0 || {
umount "$mntdir" || true umount "$mntdir" || true
umount "$mntusedir" || true umount "$mntusedir" || true
return 0 return 0

View File

@ -47,19 +47,19 @@ lvcreate -L8 -V8 -T $vg/pool -n $lv1
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26
test $(percent_) -gt 80 test "$(percent_)" -gt 80
# Give it some time to dmeventd to log WARNING # Give it some time to dmeventd to log WARNING
wait_warn_ 1 wait_warn_ 1
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
test $(percent_) -gt 90 test "$(percent_)" -gt 90
# Give it some time to dmeventd to log WARNING # Give it some time to dmeventd to log WARNING
wait_warn_ 2 wait_warn_ 2
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8
test $(percent_) -eq 100 test "$(percent_)" -eq 100
wait_warn_ 3 wait_warn_ 3
@ -74,7 +74,7 @@ sleep 11
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
test $(percent_) -gt 90 test "$(percent_)" -gt 90
lvs -a $vg lvs -a $vg
dmsetup status ${vg}-pool-tpool dmsetup status ${vg}-pool-tpool

View File

@ -70,12 +70,12 @@ mkdir "$MOUNT_DIR"
# This mkfs should fill 2MB pool over 95% # This mkfs should fill 2MB pool over 95%
# no autoresize is configured # no autoresize is configured
mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN" mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
test $(percent_) -gt 95 test "$(percent_)" -gt 95
mount "$DM_DEV_DIR/mapper/$THIN" "$MOUNT_DIR" mount "$DM_DEV_DIR/mapper/$THIN" "$MOUNT_DIR"
pvchange -x n "$dev1" "$dev2" pvchange -x n "$dev1" "$dev2"
test $(percent_) -gt 95 test "$(percent_)" -gt 95
# Configure autoresize # Configure autoresize
aux lvmconf 'activation/thin_pool_autoextend_percent = 10' \ aux lvmconf 'activation/thin_pool_autoextend_percent = 10' \
'activation/thin_pool_autoextend_threshold = 75' 'activation/thin_pool_autoextend_threshold = 75'
@ -85,7 +85,7 @@ sleep 20
# And check foreign thin device is still mounted # And check foreign thin device is still mounted
mount | grep "$MOUNT_DIR" | grep "$THIN" mount | grep "$MOUNT_DIR" | grep "$THIN"
test $(percent_) -gt 95 test "$(percent_)" -gt 95
pvchange -x y "$dev1" "$dev2" pvchange -x y "$dev1" "$dev2"
@ -96,11 +96,11 @@ lvchange --refresh $vg/pool
# Give it some time and let dmeventd do some work # Give it some time and let dmeventd do some work
for i in $(seq 1 15) ; do for i in $(seq 1 15) ; do
test $(percent_) -ge 75 || break test "$(percent_)" -ge 75 || break
sleep 1 sleep 1
done done
test $(percent_) -lt 75 test "$(percent_)" -lt 75
# And check foreign thin device is still mounted # And check foreign thin device is still mounted
mount | grep "$MOUNT_DIR" | grep "$THIN" mount | grep "$MOUNT_DIR" | grep "$THIN"

View File

@ -22,7 +22,7 @@ lvdev_() {
test_snapshot_mount() { test_snapshot_mount() {
lvcreate -aey -L4M -n $lv1 $vg "$dev1" lvcreate -aey -L4M -n $lv1 $vg "$dev1"
mkfs.ext3 $(lvdev_ $vg $lv1) mkfs.ext3 "$(lvdev_ $vg $lv1)"
mkdir test_mnt mkdir test_mnt
mount "$(lvdev_ $vg $lv1)" test_mnt mount "$(lvdev_ $vg $lv1)" test_mnt
lvcreate -L4M -n $lv2 -s $vg/$lv1 lvcreate -L4M -n $lv2 -s $vg/$lv1
@ -53,11 +53,11 @@ LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \ aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
# Test that kernel supports topology # Test that kernel supports topology
if [ ! -e /sys/block/$(basename $(< SCSI_DEBUG_DEV))/alignment_offset ] ; then if [ ! -e "/sys/block/$(basename "$(< SCSI_DEBUG_DEV)")/alignment_offset" ] ; then
aux cleanup_scsi_debug_dev aux cleanup_scsi_debug_dev
skip skip
fi fi
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size "$LOGICAL_BLOCK_SIZE"
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
get_devs get_devs

View File

@ -18,7 +18,7 @@ aux driver_at_least 4 15 || skip
aux prepare_devs 3 8 aux prepare_devs 3 8
vgcreate $vg $dev1 $dev2 vgcreate "$vg" "$dev1" "$dev2"
lvcreate -l100%FREE -n $lv $vg lvcreate -l100%FREE -n $lv $vg
dd if="$dev1" of="$dev3" bs=1M dd if="$dev1" of="$dev3" bs=1M
pvs --config "devices/global_filter = [ \"a|$dev2|\", \"a|$dev3|\", \"r|.*|\" ]" 2>err pvs --config "devices/global_filter = [ \"a|$dev2|\", \"a|$dev3|\", \"r|.*|\" ]" 2>err

View File

@ -63,7 +63,7 @@ vgimportclone --basevgname $vg2 "$dev2"
# concerned, can only live on a single device. With the last pvscan, we told it # concerned, can only live on a single device. With the last pvscan, we told it
# that PV from $dev1 now lives on $dev2, but in fact this is not true anymore, # that PV from $dev1 now lives on $dev2, but in fact this is not true anymore,
# since we wrote a different PV over $dev2. # since we wrote a different PV over $dev2.
rm -f $TESTDIR/etc/.cache rm -f "$TESTDIR/etc/.cache"
aux notify_lvmetad "$dev2" aux notify_lvmetad "$dev2"
aux notify_lvmetad "$dev1" aux notify_lvmetad "$dev1"

View File

@ -156,7 +156,7 @@ vgremove -f $vg2 $vg1
# Restart clvm because using the same # Restart clvm because using the same
# devs as lvm1 and then lvm2 causes problems. # devs as lvm1 and then lvm2 causes problems.
if test -e LOCAL_CLVMD ; then if test -e LOCAL_CLVMD ; then
kill $(< LOCAL_CLVMD) kill "$(< LOCAL_CLVMD)"
for i in $(seq 1 100) ; do for i in $(seq 1 100) ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow." test $i -eq 100 && die "Shutdown of clvmd is too slow."
pgrep clvmd || break pgrep clvmd || break