[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [patch 3/3] Update vgsplit tests for lvnames on the commandline



Signed-off-by: Dave Wysochanski <dwysocha redhat com>
---
 test/t-vgsplit-operation.sh |  134 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 114 insertions(+), 20 deletions(-)

diff --git a/test/t-vgsplit-operation.sh b/test/t-vgsplit-operation.sh
index b8ef45b..bf52eb1 100755
--- a/test/t-vgsplit-operation.sh
+++ b/test/t-vgsplit-operation.sh
@@ -56,15 +56,24 @@ test_expect_success \
 #
 for i in new existing
 do
+#
+# We can have PVs or LVs on the cmdline
+#
+for j in PV LV
+do
 test_expect_success \
-  "vgsplit correctly splits single linear LV into $i VG" \
+  "vgsplit correctly splits single linear LV into $i VG ($j args)" \
   'vgcreate $vg1 $d1 $d2 &&
    if [ $i == existing ]; then
       vgcreate $vg2 $d3 $d4
    fi &&
    lvcreate -l 4 -n $lv1 $vg1 $d1 &&
    vgchange -an $vg1 &&
-   vgsplit $vg1 $vg2 $d1 &&
+   if [ $j == PV ]; then
+     vgsplit $vg1 $vg2 $d1
+   else
+     vgsplit -n $lv1 $vg1 $vg2
+   fi &&
    vg_validate_pvlv_counts_ $vg1 1 0 0 &&
    if [ $i == existing ]; then
       vg_validate_pvlv_counts_ $vg2 3 1 0
@@ -76,14 +85,18 @@ test_expect_success \
    vgremove -f $vg1'
 
 test_expect_success \
-  "vgsplit correctly splits single striped LV into $i VG" \
+  "vgsplit correctly splits single striped LV into $i VG ($j args)" \
   'vgcreate $vg1 $d1 $d2 &&
    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 &&
+   if [ $j == PV ]; then
+     vgsplit $vg1 $vg2 $d1 $d2
+   else
+     vgsplit -n $lv1 $vg1 $vg2
+   fi &&
    if [ $i == existing ]; then
      vg_validate_pvlv_counts_ $vg2 4 1 0
    else
@@ -93,43 +106,124 @@ test_expect_success \
    vgremove -f $vg2'
 
 test_expect_success \
-  "vgsplit correctly splits origin and snapshot LV into $i VG" \
-  'vgcreate $vg1 $d1 $d2 &&
+  "vgsplit correctly splits mirror LV into $i VG ($j args)" \
+  'vgcreate $vg1 $d1 $d2 $d3 &&
    if [ $i == existing ]; then
-     vgcreate $vg2 $d3 $d4
+     vgcreate $vg2 $d4
    fi &&
-   lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 &&
-   lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 &&
+   lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 &&
    vgchange -an $vg1 &&
-   vgsplit $vg1 $vg2 $d1 $d2 &&
+   if [ $j == PV ]; then
+     vgsplit $vg1 $vg2 $d1 $d2 $d3
+   else
+     vgsplit -n $lv1 $vg1 $vg2
+   fi &&
    if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg2 4 1 1
+     vg_validate_pvlv_counts_ $vg2 4 4 0
    else
-     vg_validate_pvlv_counts_ $vg2 2 1 1
+     vg_validate_pvlv_counts_ $vg2 3 4 0
    fi &&
-   lvremove -f $vg2/$lv2 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
 
 test_expect_success \
-  "vgsplit correctly splits mirror LV into $i VG" \
-  'vgcreate $vg1 $d1 $d2 $d3 &&
+  "vgsplit correctly splits origin and snapshot LV into $i VG ($j args)" \
+  'vgcreate $vg1 $d1 $d2 &&
    if [ $i == existing ]; then
-     vgcreate $vg2 $d4
+     vgcreate $vg2 $d3 $d4
    fi &&
-   lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 &&
+   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 $d3 &&
+   if [ $j == PV ]; then
+     vgsplit $vg1 $vg2 $d1 $d2
+   else
+     vgsplit -n $lv1 $vg1 $vg2
+   fi &&
    if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg2 4 4 0
+     vg_validate_pvlv_counts_ $vg2 4 1 1
    else
-     vg_validate_pvlv_counts_ $vg2 3 4 0
+     vg_validate_pvlv_counts_ $vg2 2 1 1
    fi &&
+   lvremove -f $vg2/$lv2 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
+
+done
 done
 
+#
+# Test more complex setups where the code has to find associated PVs and
+# LVs to split the VG correctly
+# 
+test_expect_success \
+  "vgsplit fails splitting 3 striped LVs into VG when only 1 LV specified" \
+  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
+   lvcreate -l 4 -n $lv1 -i 2 $vg1 $d1 $d2 &&
+   lvcreate -l 4 -n $lv2 -i 2 $vg1 $d2 $d3 &&
+   lvcreate -l 4 -n $lv3 -i 2 $vg1 $d3 $d4 &&
+   vgchange -an $vg1 &&
+   vgsplit -n $lv1 $vg1 $vg2;
+   status=$?; echo status=$?; test $status = 5 &&
+   vgremove -ff $vg1'
+
+test_expect_success \
+  "vgsplit fails splitting one LV with 2 snapshots, only origin LV specified" \
+  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
+   lvcreate -l 16 -n $lv1 $vg1 $d1 $d2 &&
+   lvcreate -l 4 -n $lv2 -s $vg1/$lv1 &&
+   lvcreate -l 4 -n $lv3 -s $vg1/$lv1 &&
+   vg_validate_pvlv_counts_ $vg1 4 1 2 &&
+   vgchange -an $vg1 &&
+   vgsplit -n $lv1 $vg1 $vg2;
+   status=$?; echo status=$?; test $status = 5 &&
+   lvremove -f $vg1/$lv2 &&
+   lvremove -f $vg1/$lv3 &&
+   lvremove -f $vg1/$lv1 &&
+   vgremove -ff $vg1'
+
+test_expect_success \
+  "vgsplit fails splitting one LV with 2 snapshots, only snapshot LV specified" \
+  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
+   lvcreate -l 16 -n $lv1 $vg1 $d1 $d2 &&
+   lvcreate -l 4 -n $lv2 -s $vg1/$lv1 &&
+   lvcreate -l 4 -n $lv3 -s $vg1/$lv1 &&
+   vg_validate_pvlv_counts_ $vg1 4 1 2 &&
+   vgchange -an $vg1 &&
+   vgsplit -n $lv2 $vg1 $vg2;
+   status=$?; echo status=$?; test $status = 5 &&
+   lvremove -f $vg1/$lv2 &&
+   lvremove -f $vg1/$lv3 &&
+   lvremove -f $vg1/$lv1 &&
+   vgremove -ff $vg1'
+
+test_expect_success \
+  "vgsplit fails splitting one mirror LV, only one PV specified" \
+  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
+   lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 &&
+   vg_validate_pvlv_counts_ $vg1 4 4 0 &&
+   vgchange -an $vg1 &&
+   vgsplit $vg1 $vg2 $d2 &&
+   status=$?; echo status=$?; test $status = 5 &&
+   vgremove -ff $vg1'
+
+test_expect_success \
+  "vgsplit fails splitting 1 mirror + 1 striped LV, only striped LV specified" \
+  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
+   lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 &&
+   lvcreate -l 16 -n $lv2 -i 2 $vg1 $d3 $d4 &&
+   vg_validate_pvlv_counts_ $vg1 4 5 0 &&
+   vgchange -an $vg1 &&
+   vgsplit -n $lv2 $vg1 $vg2 2>err;
+   status=$?; echo status=$?; test $status = 5 &&
+   vgremove -ff $vg1'
+
+
 test_done
+
+#vgssplit_test_complex_splits_()
+# vgssplit_test_basic_splits_()
+
 # Local Variables:
 # indent-tabs-mode: nil
 # End:
-- 
1.5.3.4

-- 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]