diff --git a/test/t-vgreduce-usage.sh b/test/t-vgreduce-usage.sh index 0c2fe108b..f44bd9c2d 100755 --- a/test/t-vgreduce-usage.sh +++ b/test/t-vgreduce-usage.sh @@ -35,8 +35,6 @@ test_expect_success \ lv2=$(this_test_)-test-lv2-$$ && lv3=$(this_test_)-test-lv3-$$' -#TODO --removemissing (+ -- mirrorsonly) - for mdatype in 1 2 do test_expect_success \ @@ -72,7 +70,7 @@ test_expect_success \ test_expect_success \ "(lvm$mdatype) remove PVs " ' - pvremove -ff $d1 $d2 + pvremove -ff $d1 $d2 ' done @@ -80,8 +78,8 @@ for mdatype in 2 do test_expect_success \ "(lvm$mdatype) setup PVs (--metadatacopies 0)" ' - pvcreate -M$mdatype $d1 $d2 && - pvcreate --metadatacopies 0 -M$mdatype $d3 $d4 + pvcreate -M$mdatype $d1 $d2 && + pvcreate --metadatacopies 0 -M$mdatype $d3 $d4 ' test_expect_success \ @@ -92,6 +90,64 @@ test_expect_success \ vgremove -f $vg1 } ' + +test_expect_success \ + "cleanup" ' + vgremove -ff $vg1; true +' +test_expect_success \ + "(lvm$mdatype) setup: create mirror & damage one pv" ' + vgcreate -M$mdatype $vg1 $d1 $d2 $d3 && + lvcreate -n $lv1 -m1 -l 16 $vg1 && + lvcreate -n $lv2 -l 16 $vg1 $d2 && + lvcreate -n $lv3 -l 16 $vg1 $d3 && + vgchange -an $vg1 && + pvcreate -ff -y $d1 +' +test_expect_success \ + "(lvm$mdatype) vgreduce --removemissing --force repares to linear" ' + vgreduce --removemissing --force $vg1 && + check_lv_field_ $vg1/$lv1 segtype linear && + vg_validate_pvlv_counts_ $vg1 2 3 0 +' +test_expect_success \ + "cleanup" ' + vgremove -ff $vg1 +' + +test_expect_success \ + "(lvm$mdatype) setup: create mirror + linear lvs" ' + vgcreate -M$mdatype $vg1 $d1 && + lvcreate -n $lv2 -l 16 $vg1 && + lvcreate -n $lv1 -l 4 $vg1 && + vgextend $vg1 $d2 $d3 && + lvcreate -n $lv3 -l 16 $vg1 $d3 && + lvconvert -m1 $vg1/$lv1 +' +test_debug ' + pvs --segments -o +lv_name +' +test_expect_success \ + "(lvm$mdatype) setup: damage one pv" ' + vgchange -an $vg1 && + pvcreate -ff -y $d1 +' +test_expect_failure \ + "(lvm$mdatype) vgreduce rejects --removemissing --mirrorsonly --force when nonmirror lv lost too" ' + vgreduce --removemissing --mirrorsonly --force $vg1 +' + +test_debug ' + pvs -P + lvs -P + vgs -P +' + +test_expect_success \ + "cleanup" ' + vgreduce --removemissing --force $vg1 + vgremove -ff $vg1 +' done