1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

In testsuite, catch also failures that happen in the middle of a pipeline.

This commit is contained in:
Petr Rockai 2010-02-17 15:41:28 +00:00
parent 97d91b30e6
commit 943c443426
6 changed files with 24 additions and 21 deletions

View File

@ -35,7 +35,7 @@ lvremove -f $vg/$lv
# 'lvextend computes necessary free space correctly - bz213552' # 'lvextend computes necessary free space correctly - bz213552'
vgsize=$(vgs -o vg_extent_count --noheadings) vgsize=$(vgs -o vg_extent_count --noheadings)
lvcreate -l $vgsize -n $lv $vg lvcreate -l $vgsize -n $lv $vg
yes | lvreduce -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'

View File

@ -31,11 +31,13 @@ mimages_are_redundant_ ()
local i local i
rm -f out rm -f out
lvs -odevices --noheadings $lv | sed 's/([^)]*)//g; s/,/ /g'
for i in $(lvs -odevices --noheadings $lv | sed 's/([^)]*)//g; s/,/ /g'); do for i in $(lvs -odevices --noheadings $lv | sed 's/([^)]*)//g; s/,/ /g'); do
lvs -a -odevices --noheadings $vg/$i | sed 's/([^)]*)//g; s/,/ /g' | \ lvs -a -odevices --noheadings $vg/$i | sed 's/([^)]*)//g; s/,/ /g' | \
sort | uniq >> out sort | uniq >> out || true
done done
cat out
# if any duplication is found, it's not redundant # if any duplication is found, it's not redundant
sort out | uniq -d | grep . && return 1 sort out | uniq -d | grep . && return 1
@ -181,7 +183,7 @@ check_and_cleanup_lvs_
#COMM "convert from linear to 2-way mirror" #COMM "convert from linear to 2-way mirror"
prepare_lvs_ prepare_lvs_
lvcreate -l2 -n $lv1 $vg $dev1 lvcreate -l2 -n $lv1 $vg $dev1
lvconvert -m+1 $vg/$lv1 $dev2 $dev3:0-1 lvconvert -i1 -m+1 $vg/$lv1 $dev2 $dev3:0-1
mimages_are_redundant_ $vg $lv1 mimages_are_redundant_ $vg $lv1
mirrorlog_is_on_ $vg/$lv1 $dev3 mirrorlog_is_on_ $vg/$lv1 $dev3
check_and_cleanup_lvs_ check_and_cleanup_lvs_
@ -196,21 +198,21 @@ check_and_cleanup_lvs_
for status in active inactive; do for status in active inactive; do
# bz192865 lvconvert log of an inactive mirror lv # bz192865 lvconvert log of an inactive mirror lv
#COMM "convert from disklog to corelog" #COMM "convert from disklog to corelog"
prepare_lvs_ prepare_lvs_
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1 lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
test $status = "inactive" && lvchange -an $vg/$lv1 test $status = "inactive" && lvchange -an $vg/$lv1
yes | lvconvert --mirrorlog core $vg/$lv1 echo y | lvconvert -f --mirrorlog core $vg/$lv1
mimages_are_redundant_ $vg $lv1 mimages_are_redundant_ $vg $lv1
check_and_cleanup_lvs_ check_and_cleanup_lvs_
#COMM "convert from corelog to disklog" #COMM "convert from corelog to disklog"
prepare_lvs_ prepare_lvs_
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2 lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
test $status = "inactive" && lvchange -an $vg/$lv1 test $status = "inactive" && lvchange -an $vg/$lv1
lvconvert --mirrorlog disk $vg/$lv1 $dev3:0-1 lvconvert --mirrorlog disk $vg/$lv1 $dev3:0-1
mimages_are_redundant_ $vg $lv1 mimages_are_redundant_ $vg $lv1
mirrorlog_is_on_ $vg/$lv1 $dev3 mirrorlog_is_on_ $vg/$lv1 $dev3
check_and_cleanup_lvs_ check_and_cleanup_lvs_
done done
# --- # ---
@ -267,7 +269,7 @@ check_and_cleanup_lvs_
prepare_lvs_ prepare_lvs_
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1 lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
mirrorlog_is_on_ $vg/$lv1 $dev3 mirrorlog_is_on_ $vg/$lv1 $dev3
yes | lvchange --resync $vg/$lv1 echo y | lvchange --resync $vg/$lv1
mirrorlog_is_on_ $vg/$lv1 $dev3 mirrorlog_is_on_ $vg/$lv1 $dev3
check_and_cleanup_lvs_ check_and_cleanup_lvs_

View File

@ -58,6 +58,7 @@ mirrorlog_is_on_()
{ {
local lv="$1"_mlog local lv="$1"_mlog
shift 1 shift 1
if ! lvs -a $lv; then return 0; fi # FIXME?
lvs -a -odevices --noheadings $lv | sed 's/,/\n/g' > out lvs -a -odevices --noheadings $lv | sed 's/,/\n/g' > out
for d in $*; do grep "$d(" out || return 1; done for d in $*; do grep "$d(" out || return 1; done
for d in $*; do grep -v "$d(" out > out2 || true; mv out2 out; done for d in $*; do grep -v "$d(" out > out2 || true; mv out2 out; done

View File

@ -52,7 +52,7 @@ for mdacp in 0 1 2; do
echo n | not pvremove -ff $dev1 echo n | not pvremove -ff $dev1
# pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp) # pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp)
yes | pvremove -ff $dev1 pvremove -ffy $dev1
not pvs $dev1 not pvs $dev1
vgreduce --removemissing $vg vgreduce --removemissing $vg

View File

@ -36,7 +36,7 @@ lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg"
ra="$(get_lvs_ lv_kernel_read_ahead)" ra="$(get_lvs_ lv_kernel_read_ahead)"
test "$(( ( $ra / 5 ) * 5 ))" -eq $ra test "$(( ( $ra / 5 ) * 5 ))" -eq $ra
lvdisplay "$vg"/"$lv" lvdisplay "$vg"/"$lv"
lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto not lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto
check_lvs_ lv_read_ahead auto check_lvs_ lv_read_ahead auto
check_lvs_ lv_kernel_read_ahead 5120 check_lvs_ lv_kernel_read_ahead 5120
lvchange -r 640 "$vg/$lv" lvchange -r 640 "$vg/$lv"

View File

@ -302,6 +302,6 @@ prepare_lvmconf() {
EOF EOF
} }
set -vexE set -vexE -o pipefail
aux prepare_lvmconf aux prepare_lvmconf