diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-05-15 10:25:25 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-05-15 12:08:35 +0200 |
commit | 76c06c72523201bdb478bd1735b2fcfbe49d3d38 (patch) | |
tree | dd031c1dca309e3be6babd311d6b07ac606ed3c4 /test/shell/lvchange-raid.sh | |
parent | 309201a53bcbbd4967f380214e688c520b957fdf (diff) | |
download | lvm2-76c06c72523201bdb478bd1735b2fcfbe49d3d38.tar.gz |
tests: speedup
Avoid some expencive raid/mirror synchronization when testing
just allocation sizes.
Use lv_attr_bit
Diffstat (limited to 'test/shell/lvchange-raid.sh')
-rw-r--r-- | test/shell/lvchange-raid.sh | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh index afa243150..8ef6c33af 100644 --- a/test/shell/lvchange-raid.sh +++ b/test/shell/lvchange-raid.sh @@ -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> |