master - tests: speedup
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=76c06c72523201bdb478bd1735b2fcfbe49d3d38 Commit: 76c06c72523201bdb478bd1735b2fcfbe49d3d38 Parent: 309201a53bcbbd4967f380214e688c520b957fdf Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu May 15 10:25:25 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu May 15 12:08:35 2014 +0200
tests: speedup
Avoid some expencive raid/mirror synchronization when testing just allocation sizes.
Use lv_attr_bit
--- test/shell/lvchange-raid.sh | 62 ++++++++++++++-------------- test/shell/lvconvert-mirror-basic.sh | 2 +- test/shell/lvcreate-pvtags.sh | 4 +- test/shell/lvcreate-raid.sh | 74 +++++++++++++++------------------ test/shell/lvcreate-raid10.sh | 16 +++----- test/shell/snapshots-of-mirrors.sh | 4 +- test/shell/vgsplit-operation.sh | 6 +- 7 files changed, 79 insertions(+), 89 deletions(-)
test/shell/lvchange-raid.sh +31 -31
@@ -37,8 +37,8 @@ run_writemostly_check() { $vg $lv $segtype # No writemostly flag should be there yet. - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" + check lv_attr_bit health $vg/${lv}_rimage_1 "-" if [ "$segtype" != "raid1" ]; then not lvchange --writemostly $d0 $vg/$lv
@@ -47,71 +47,71 @@ run_writemostly_check() { # Set the flag lvchange --writemostly $d0 $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # Running again should leave it set (not toggle) lvchange --writemostly $d0 $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # Running again with ':y' should leave it set lvchange --writemostly $d0:y $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # ':n' should unset it lvchange --writemostly $d0:n $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" # ':n' again should leave it unset lvchange --writemostly $d0:n $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" # ':t' toggle to set lvchange --writemostly $d0:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # ':t' toggle to unset lvchange --writemostly $d0:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" # ':y' to set lvchange --writemostly $d0:y $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # Toggle both at once lvchange --writemostly $d0:t --writemostly $d1:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" + check lv_attr_bit health $vg/${lv}_rimage_1 "w" # Toggle both at once again lvchange --writemostly $d0:t --writemostly $d1:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" + check lv_attr_bit health $vg/${lv}_rimage_1 "-" # Toggle one, unset the other lvchange --writemostly $d0:n --writemostly $d1:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" + check lv_attr_bit health $vg/${lv}_rimage_1 "w" # Toggle one, set the other lvchange --writemostly $d0:y --writemostly $d1:t $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "w" + check lv_attr_bit health $vg/${lv}_rimage_1 "-" # Partial flag supercedes writemostly flag aux disable_dev $d0 - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*p.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "p" # It is possible for the kernel to detect the failed device before # we re-enable it. If so, the field will be set to 'r'efresh since # that also takes precedence over 'w'ritemostly. If this has happened, # we refresh the LV and then check for 'w'. aux enable_dev $d0 - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*r.$' && lvchange --refresh $vg/$lv - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*w.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "r" && lvchange --refresh $vg/$lv + check lv_attr_bit health $vg/${lv}_rimage_0 "w" # Catch Bad writebehind values - not lvchange --writebehind "invalid" $vg/$lv - not lvchange --writebehind -256 $vg/$lv + invalid lvchange --writebehind "invalid" $vg/$lv + invalid lvchange --writebehind -256 $vg/$lv # Set writebehind check lv_field $vg/$lv raid_write_behind ""
@@ -122,8 +122,8 @@ run_writemostly_check() { lvconvert -m 0 $vg/$lv $d1 lvconvert --type raid1 -m 1 $vg/$lv $d1 check lv_field $vg/$lv raid_write_behind "" - get lv_field $vg/${lv}_rimage_0 lv_attr -a | grep '.*-.$' - get lv_field $vg/${lv}_rimage_1 lv_attr -a | grep '.*-.$' + check lv_attr_bit health $vg/${lv}_rimage_0 "-" + check lv_attr_bit health $vg/${lv}_rimage_1 "-" } # run_syncaction_check <VG> <LV>
@@ -152,7 +152,7 @@ run_syncaction_check() { seek=$(($seek + $size)) # Jump halfway through the RAID image - get lv_field $vg/$lv lv_attr | grep '.*-.$' + check lv_attr_bit health $vg/$lv "-" check lv_field $vg/$lv raid_mismatch_count "0" # Overwrite the last half of one of the PVs with crap
@@ -192,7 +192,7 @@ run_syncaction_check() { # 'lvs' should show results lvchange --syncaction check $vg/$lv aux wait_for_sync $vg $lv - get lv_field $vg/$lv lv_attr | grep '.*-.$' + check lv_attr_bit health $vg/$lv "-" check lv_field $vg/$lv raid_mismatch_count "0" }
@@ -220,7 +220,7 @@ run_refresh_check() { sync # Check for 'p'artial flag - get lv_field $vg/$lv lv_attr | grep '.*p.$' + check lv_attr_bit health $vg/$lv "p" dmsetup status lvs -a -o name,attr,devices $vg
@@ -230,18 +230,18 @@ run_refresh_check() { lvs -a -o name,attr,devices $vg # Check for 'r'efresh flag - get lv_field $vg/$lv lv_attr | grep '.*r.$' + check lv_attr_bit health $vg/$lv "r" lvchange --refresh $vg/$lv aux wait_for_sync $vg $lv - get lv_field $vg/$lv lv_attr | grep '.*-.$' + check lv_attr_bit health $vg/$lv "-" # Writing random data above should mean that the devices # were out-of-sync. The refresh should have taken care # of properly reintegrating the device. lvchange --syncaction repair $vg/$lv aux wait_for_sync $vg $lv - get lv_field $vg/$lv lv_attr | grep '.*-.$' + check lv_attr_bit health $vg/$lv "-" } # run_recovery_rate_check <VG> <LV>
test/shell/lvconvert-mirror-basic.sh +1 -1
@@ -77,7 +77,7 @@ test_lvconvert() { fi lvcreate -aey -l2 --type mirror -m $start_count --mirrorlog $start_log_type \ - -n $lv1 $vg $alloc + --nosync -n $lv1 $vg $alloc check mirror_legs $vg $lv1 $start_count_p1 # FIXME: check mirror log else
test/shell/lvcreate-pvtags.sh +2 -2
@@ -31,10 +31,10 @@ not lvcreate -l4 -i4 $vg @fast not lvcreate -l2 -i2 $vg "$DM_DEV_DIR/mapper/pv1" # lvcreate mirror -lvcreate -aey -l1 --type mirror -m1 $vg @fast +lvcreate -aey -l1 --type mirror -m1 --nosync $vg @fast # lvcreate mirror w/corelog -lvcreate -aey -l1 --type mirror -m2 --corelog $vg @fast +lvcreate -aey -l1 --type mirror -m2 --corelog --nosync $vg @fast # lvcreate mirror w/no free PVs not lvcreate -aey -l1 --type mirror -m2 $vg @fast
test/shell/lvcreate-raid.sh +34 -40
171 lines not on this page · raw message
test/shell/lvcreate-raid10.sh +6 -10
@@ -12,11 +12,7 @@ . lib/test lv_devices() { - local local_vg=$1 - local local_lv=$2 - local count=$3 - - [ $count == `lvs --noheadings -o devices $local_vg/$local_lv | sed s/,/' '/g | wc -w` ] + test $3 -eq $(get lv_devices $1/$2 | wc -w) } ########################################################
@@ -41,10 +37,10 @@ lvremove -ff $vg/$lv1 # 2-way mirror, 2-stripes - Set min/max recovery rate lvcreate --type raid10 -m 1 -i 2 -l 2 \ - --minrecoveryrate 50 --maxrecoveryrate 100 \ + --minrecoveryrate 50 --maxrecoveryrate 1M \ -n $lv1 $vg check lv_field $vg/$lv1 raid_min_recovery_rate 50 -check lv_field $vg/$lv1 raid_max_recovery_rate 100 +check lv_field $vg/$lv1 raid_max_recovery_rate 1024 aux wait_for_sync $vg $lv1 # 2-way mirror, 3-stripes
@@ -57,7 +53,7 @@ lvremove -ff $vg # 37 extents / device # 1 image = 36 extents (1 for meta) # 3 images = 108 extents = 54.00m -lvcreate --type raid10 -i 3 -l 100%FREE -n raid10 $vg +lvcreate --type raid10 -i 3 -l 100%FREE -an -Zn -n raid10 $vg check lv_field $vg/raid10 size "54.00m" lvremove -ff $vg
@@ -68,12 +64,12 @@ lvremove -ff $vg not lvcreate --type raid10 -l2 $vg "$dev1" "$dev2" "$dev3" # Implicit count comes from #PVs given (always 2-way mirror) -lvcreate --type raid10 -l2 -n raid10 $vg "$dev1" "$dev2" "$dev3" "$dev4" +lvcreate --type raid10 -l2 -an -Zn -n raid10 $vg "$dev1" "$dev2" "$dev3" "$dev4" lv_devices $vg raid10 4 lvremove -ff $vg # Implicit count comes from total #PVs in VG (always 2 for mirror though) -lvcreate --type raid10 -l2 -n raid10 $vg +lvcreate --type raid10 -l2 -an -Zn -n raid10 $vg lv_devices $vg raid10 6 lvremove -ff $vg
test/shell/snapshots-of-mirrors.sh +2 -2
@@ -13,9 +13,9 @@ aux prepare_vg 4 -# Attempt to create snapshot of a mirror origin - should fail -lvcreate -aey --type mirror -m 1 -L 10M -n lv $vg +lvcreate -aey --type mirror -m 1 -L 10M --nosync -n lv $vg +# Create snapshot of a mirror origin lvcreate -s $vg/lv -L 10M -n snap # Down-convert (mirror -> linear) under a snapshot
test/shell/vgsplit-operation.sh +3 -3
@@ -278,7 +278,7 @@ vgremove -ff $vg1 COMM "vgsplit fails splitting 1 mirror + 1 striped LV, only striped LV specified" create_vg_ $vg1 "$dev1" "$dev2" "$dev3" "$dev4" -lvcreate -an -Zn -l 16 -n $lv1 --type mirror -m1 $vg1 "$dev1" "$dev2" "$dev3" +lvcreate -an -Zn -l 16 -n $lv1 --type mirror --nosync -m1 $vg1 "$dev1" "$dev2" "$dev3" lvcreate -an -Zn -l 16 -n $lv2 -i 2 $vg1 "$dev3" "$dev4" check pvlv_counts $vg1 4 2 0 not vgsplit -n $lv2 $vg1 $vg2 2>err
@@ -289,7 +289,7 @@ vgremove -f $vg1 # COMM "vgsplit fails, active mirror involved in split" create_vg_ $vg1 "$dev1" "$dev2" "$dev3" "$dev4" -lvcreate -aey -l 16 -n $lv1 --type mirror -m1 $vg1 "$dev1" "$dev2" "$dev3" +lvcreate -aey -l 16 -n $lv1 --type mirror --nosync -m1 $vg1 "$dev1" "$dev2" "$dev3" lvcreate -l 16 -n $lv2 $vg1 "$dev4" lvchange -an $vg1/$lv2 check pvlv_counts $vg1 4 2 0
@@ -299,7 +299,7 @@ vgremove -f $vg1 COMM "vgsplit succeeds, active mirror not involved in split" create_vg_ $vg1 "$dev1" "$dev2" "$dev3" "$dev4" -lvcreate -aey -l 16 -n $lv1 --type mirror -m1 $vg1 "$dev1" "$dev2" "$dev3" +lvcreate -aey -l 16 -n $lv1 --type mirror --nosync -m1 $vg1 "$dev1" "$dev2" "$dev3" lvcreate -l 16 -n $lv2 $vg1 "$dev4" lvchange -an $vg1/$lv2 check pvlv_counts $vg1 4 2 0