From dff4e43269b520b24fbf631cb1352219e3523d83 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Fri, 21 Mar 2008 21:14:38 +0000 Subject: [PATCH] Update vgsplit tests to execute twice (existing and new VG as destination). --- test/t-vgsplit-operation.sh | 66 +++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/test/t-vgsplit-operation.sh b/test/t-vgsplit-operation.sh index dc6dbfd92..f80fe1a22 100755 --- a/test/t-vgsplit-operation.sh +++ b/test/t-vgsplit-operation.sh @@ -23,7 +23,7 @@ cleanup_() rm -f "$f1" "$f2" "$f3" "$f4" } -validate_vg_pvlv_counts_() +vg_validate_pvlv_counts_() { local local_vg=$1 local num_pvs=$2 @@ -51,53 +51,83 @@ test_expect_success \ lv3=$(this_test_)-test-lv3-$$ && pvcreate $d1 $d2 $d3 $d4' +# +# vgsplit can be done into a new or existing VG +# +for i in new existing +do test_expect_success \ - 'vgsplit correctly splits single linear LV into existing VG' \ + "vgsplit correctly splits single linear LV into $i VG" \ 'vgcreate $vg1 $d1 $d2 && - vgcreate $vg2 $d3 $d4 && + if [ $i == existing ]; then + vgcreate $vg2 $d3 $d4 + fi && lvcreate -l 4 -n $lv1 $vg1 $d1 && vgchange -an $vg1 && - vgsplit $vg1 $vg2 $d1 && - validate_vg_pvlv_counts_ $vg1 1 0 0 && - validate_vg_pvlv_counts_ $vg2 3 1 0 && + vgsplit --force $vg1 $vg2 $d1 && + vg_validate_pvlv_counts_ $vg1 1 0 0 && + if [ $i == existing ]; then + vg_validate_pvlv_counts_ $vg2 3 1 0 + else + vg_validate_pvlv_counts_ $vg2 1 1 0 + fi && lvremove -f $vg2/$lv1 && vgremove -f $vg2 && vgremove -f $vg1' test_expect_success \ - 'vgsplit correctly splits single striped LV into existing VG' \ + "vgsplit correctly splits single striped LV into $i VG" \ 'vgcreate $vg1 $d1 $d2 && - vgcreate $vg2 $d3 $d4 && + if [ $i == existing ]; then + vgcreate $vg2 $d3 $d4 + fi && lvcreate -l 4 -i 2 -n $lv1 $vg1 $d1 $d2 && vgchange -an $vg1 && - vgsplit $vg1 $vg2 $d1 $d2 && - validate_vg_pvlv_counts_ $vg2 4 1 0 && + vgsplit --force $vg1 $vg2 $d1 $d2 && + if [ $i == existing ]; then + vg_validate_pvlv_counts_ $vg2 4 1 0 + else + vg_validate_pvlv_counts_ $vg2 2 1 0 + fi && lvremove -f $vg2/$lv1 && vgremove -f $vg2' test_expect_success \ - 'vgsplit correctly splits origin and snapshot LV into existing VG' \ + "vgsplit correctly splits origin and snapshot LV into $i VG" \ 'vgcreate $vg1 $d1 $d2 && - vgcreate $vg2 $d3 $d4 && + if [ $i == existing ]; then + vgcreate $vg2 $d3 $d4 + fi && lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 && lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 && vgchange -an $vg1 && - vgsplit $vg1 $vg2 $d1 $d2 && - validate_vg_pvlv_counts_ $vg2 4 1 1 && + vgsplit --force $vg1 $vg2 $d1 $d2 && + if [ $i == existing ]; then + vg_validate_pvlv_counts_ $vg2 4 1 1 + else + vg_validate_pvlv_counts_ $vg2 2 1 1 + fi && lvremove -f $vg2/$lv2 && lvremove -f $vg2/$lv1 && vgremove -f $vg2' test_expect_success \ - 'vgsplit correctly splits mirror LV into existing VG' \ + "vgsplit correctly splits mirror LV into $i VG" \ 'vgcreate $vg1 $d1 $d2 $d3 && - vgcreate $vg2 $d4 && + if [ $i == existing ]; then + vgcreate $vg2 $d4 + fi && lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 && vgchange -an $vg1 && - vgsplit $vg1 $vg2 $d1 $d2 $d3 && - validate_vg_pvlv_counts_ $vg2 4 4 0 && + vgsplit --force $vg1 $vg2 $d1 $d2 $d3 && + if [ $i == existing ]; then + vg_validate_pvlv_counts_ $vg2 4 4 0 + else + vg_validate_pvlv_counts_ $vg2 3 4 0 + fi && lvremove -f $vg2/$lv1 && vgremove -f $vg2' +done test_done # Local Variables: