Skip to contentSkip to conversation

LVM: testsuite fixes

PATCH New Jonathan Brassow 2 participants 2 messages Mar 18, 2010 – Mar 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LVM: testsuite fixes

Patch name: lvm-testsuite-fixes.patch

t-lvconvert-repair-policy.sh fails and readds devices as necesary for its tests. When the devices are re-added to the VG, their ordering in the allocation list changes. So, the ordering of mirror devices and logs for successive iterations will change. Thus, "$dev1" will not always be the first leg of a mirror. This property was; however, being assumed. Tests were failing because they were not testing what they though they were testing.

This patch makes it so that the creation of mirrors will always lay them down in exactly the same way.

[I still have my concerns about the way only one of the two
available policy specifications is stated when 'repair' is called. This means we really don't know what the policy is for the one that isn't specified.]

test/t-lvconvert-repair-policy.sh +16 -5
Index: LVM2/test/t-lvconvert-repair-policy.sh
===================================================================
@@ -13,12 +13,15 @@
 
 prepare_vg 4
 
+# Clean-up and create a 2-way mirror, where the the
+# leg devices are always on $dev[12] and the log
+# is always on $dev3.  ($dev4 behaves as a spare)
 cleanup() {
 	vgreduce --removemissing $vg
 	for d in "$@"; do enable_dev $d; done
 	for d in "$@"; do vgextend $vg $d; done
 	lvremove -ff $vg/mirror
-	lvcreate -m 1 -L 1 -n mirror $vg
+	lvcreate -m 1 -L 1 -n mirror $vg $dev1 $dev2 $dev3:0
 }
 
 repair() {
@@ -28,34 +31,42 @@ repair() {
 lvcreate -m 1 -L 1 -n mirror $vg
 lvchange -a n $vg/mirror
 
+# Fail a leg of a mirror.
+# Expected result: linear
 disable_dev $dev1
 lvchange --partial -a y $vg/mirror
 repair 'activation { mirror_image_fault_policy = "remove" }'
 lvs | grep -- -wi-a- # non-mirror
 cleanup $dev1
 
+# Fail a leg of a mirror.
+# Expected result: Mirror (leg replaced)
 disable_dev $dev1
 repair 'activation { mirror_image_fault_policy = "replace" }'
 lvs | grep -- mwi-a- # mirror
 lvs | grep mirror_mlog
 cleanup $dev1
 
+# Fail a leg of a mirror (use old name for policy specification)
+# Expected result: Mirror (leg replaced)
 disable_dev $dev1
 repair 'activation { mirror_device_fault_policy = "replace" }'
 lvs | grep -- mwi-a- # mirror
 lvs | grep mirror_mlog
 cleanup $dev1
 
+# Fail a leg of a mirror w/ no available spare
+# Expected result: linear
 disable_dev $dev2 $dev4
-# no room for repair, downconversion should happen
 repair 'activation { mirror_image_fault_policy = "replace" }'
 lvs | grep -- -wi-a-
 cleanup $dev2 $dev4
 
-disable_dev $dev2 $dev4
-# no room for new log, corelog conversion should happen
+# Fail the log device of a mirror w/ no available spare
+# Expected result: mirror w/ corelog
+disable_dev $dev3 $dev4
 repair 'activation { mirror_image_fault_policy = "replace" }'
 lvs
 lvs | grep -- mwi-a-
 lvs | not grep mirror_mlog
-cleanup $dev2 $dev4
+cleanup $dev3 $dev4
#1 lore raw

PATCH 1/1 LVM: testsuite fixes

Hi,

Quoted 4 lines · Jonathan Brassow

[I still have my concerns about the way only one of the two
available policy specifications is stated when 'repair' is called. This means we really don't know what the policy is for the one that isn't specified.]

Well, it means that if the default is flipped, tests start failing and you explicitly have to confirm your defaults change. I think that's reasonable.

Quoted 8 lines

Index: LVM2/test/t-lvconvert-repair-policy.sh
===================================================================

test/t-lvconvert-repair-policy.sh +0 -0
@@ -13,12 +13,15 @@
 
 prepare_vg 4
 

test/t-lvconvert-repair-policy.sh line 24

Quoted 10 lines
test/t-lvconvert-repair-policy.sh +4 -1
+# Clean-up and create a 2-way mirror, where the the
+# leg devices are always on $dev[12] and the log
+# is always on $dev3.  ($dev4 behaves as a spare)
 cleanup() {
 	vgreduce --removemissing $vg
 	for d in "$@"; do enable_dev $d; done
 	for d in "$@"; do vgextend $vg $d; done
 	lvremove -ff $vg/mirror
-	lvcreate -m 1 -L 1 -n mirror $vg
+	lvcreate -m 1 -L 1 -n mirror $vg $dev1 $dev2 $dev3:0

Maybe it should say -l 2 or something, to make it more explicit that $dev3:0 means that $dev3 ends up holding the log.

[cut]

test/t-lvconvert-repair-policy.sh repair() { · line 72

Quoted 11 lines
test/t-lvconvert-repair-policy.sh +4 -3
-disable_dev $dev2 $dev4
-# no room for new log, corelog conversion should happen
+# Fail the log device of a mirror w/ no available spare
+# Expected result: mirror w/ corelog
+disable_dev $dev3 $dev4
 repair 'activation { mirror_image_fault_policy = "replace" }'
 lvs
 lvs | grep -- mwi-a-
 lvs | not grep mirror_mlog
-cleanup $dev2 $dev4
+cleanup $dev3 $dev4

ACK (also, can go in right away)

Yours,
Petr.