public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/test t-vgsplit-operation.sh
@ 2008-09-30 17:56 mornfall
  0 siblings, 0 replies; 11+ messages in thread
From: mornfall @ 2008-09-30 17:56 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-09-30 17:56:54

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Conversion of t-vgsplit-operation.sh by jstava.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.21&r2=1.22

--- LVM2/test/t-vgsplit-operation.sh	2008/04/11 14:06:16	1.21
+++ LVM2/test/t-vgsplit-operation.sh	2008/09/30 17:56:54	1.22
@@ -9,323 +9,282 @@
 # along with this program; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-test_description='Test vgsplit operation, including different LV types'
-privileges_required_=1
+# Test vgsplit operation, including different LV types
 
-. ./test-lib.sh
+. ./test-utils.sh
 
-cleanup_()
-{
-  test -n "$d1" && losetup -d "$d1"
-  test -n "$d2" && losetup -d "$d2"
-  test -n "$d3" && losetup -d "$d3"
-  test -n "$d4" && losetup -d "$d4"
-  test -n "$d5" && losetup -d "$d5"
-  rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
+COMM() {  
+	LAST_TEST="$@"
 }
 
+prepare_pvs 5 257
 # FIXME: paramaterize lvm1 vs lvm2 metadata; most of these tests should run
 # fine with lvm1 metadata as well; for now, just add disks 5 and 6 as lvm1
 # metadata
-test_expect_success \
-  'set up temp files, loopback devices, PVs, vgnames' \
-  'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
-   f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
-   f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
-   f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
-   f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
-   vg1=$(this_test_)-test-vg1-$$          &&
-   vg2=$(this_test_)-test-vg2-$$          &&
-   lv1=$(this_test_)-test-lv1-$$          &&
-   lv2=$(this_test_)-test-lv2-$$          &&
-   lv3=$(this_test_)-test-lv3-$$          &&
-   pvcreate $d1 $d2 $d3 $d4 $d5'
 
 #
 # vgsplit can be done into a new or existing VG
 #
 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 ($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 &&
-   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
-   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 $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 &&
-   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
-     vg_validate_pvlv_counts_ $vg2 2 1 0
-   fi &&
-   lvremove -f $vg2/$lv1 &&
-   vgremove -f $vg2'
-
-test_expect_success \
-  "vgsplit correctly splits mirror LV into $i VG ($j args)" \
-  'vgcreate $vg1 $d1 $d2 $d3 &&
-   if [ $i == existing ]; then
-     vgcreate $vg2 $d4
-   fi &&
-   lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 &&
-   vgchange -an $vg1 &&
-   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 0
-   else
-     vg_validate_pvlv_counts_ $vg2 3 1 0
-   fi &&
-   lvremove -f $vg2/$lv1 &&
-   vgremove -f $vg2'
-
-test_expect_success \
-  "vgsplit correctly splits origin and snapshot LV into $i VG ($j args)" \
-  'vgcreate $vg1 $d1 $d2 &&
-   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 &&
-   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 2 1
-   else
-     vg_validate_pvlv_counts_ $vg2 2 2 1
-   fi &&
-   lvremove -f $vg2/$lv2 &&
-   lvremove -f $vg2/$lv1 &&
-   vgremove -f $vg2'
-
-test_expect_success \
-  "vgsplit correctly splits linear LV but not snap+origin LV into $i VG ($j args)" \
-  'vgcreate $vg1 $d1 $d2 &&
-   if [ $i == existing ]; then
-     vgcreate $vg2 $d3
-   fi &&
-   lvcreate -l 64 -i 2 -n $lv1 $vg1 &&
-   lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 &&
-   vgextend $vg1 $d4 &&
-   lvcreate -l 64 -n $lv3 $vg1 $d4 &&
-   vgchange -an $vg1 &&
-   if [ $j == PV ]; then
-     vgsplit $vg1 $vg2 $d4
-   else
-     vgsplit -n $lv3 $vg1 $vg2
-   fi &&
-   if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg2 2 1 0
-     vg_validate_pvlv_counts_ $vg1 2 2 1
-   else
-     vg_validate_pvlv_counts_ $vg2 1 1 0
-     vg_validate_pvlv_counts_ $vg1 2 2 1
-   fi &&
-   lvremove -f $vg1/$lv2 &&
-   lvremove -f $vg1/$lv1 &&
-   lvremove -f $vg2/$lv3 &&
-   vgremove -f $vg1 &&
-   vgremove -f $vg2'
-
-test_expect_success \
-  "vgsplit correctly splits linear LV but not mirror LV into $i VG ($j args)" \
-  'vgcreate $vg1 $d1 $d2 $d3 &&
-   if [ $i == existing ]; then
-     vgcreate $vg2 $d5
-   fi &&
-   lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 &&
-   vgextend $vg1 $d4 &&
-   lvcreate -l 64 -n $lv2 $vg1 $d4 &&
-   vgchange -an $vg1 &&
-   if [ $j == PV ]; then
-     vgsplit $vg1 $vg2 $d4
-   else
-     vgsplit -n $lv2 $vg1 $vg2
-   fi &&
-   if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg1 3 2 0
-     vg_validate_pvlv_counts_ $vg2 2 1 0
-   else
-     vg_validate_pvlv_counts_ $vg1 3 2 0
-     vg_validate_pvlv_counts_ $vg2 1 1 0
-   fi &&
-   lvremove -f $vg1/$lv1 &&
-   lvremove -f $vg2/$lv2 &&
-   vgremove -f $vg1 &&
-   vgremove -f $vg2'
+	#
+	# We can have PVs or LVs on the cmdline
+	#
+	for j in PV LV
+	do
+COMM "vgsplit correctly splits single linear LV into $i VG ($j args)"
+		vgcreate $vg1 $dev1 $dev2 
+		if [ $i == existing ]; then
+		   vgcreate $vg2 $dev3 $dev4
+		fi 
+		lvcreate -l 4 -n $lv1 $vg1 $dev1 
+		vgchange -an $vg1 
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev1
+		else
+		  vgsplit -n $lv1 $vg1 $vg2
+		fi 
+		vg_validate_pvlv_counts_ $vg1 1 0 0 
+		if [ $i == existing ]; then
+		   aux vg_validate_pvlv_counts_ $vg2 3 1 0
+		else
+		   aux vg_validate_pvlv_counts_ $vg2 1 1 0
+		fi 
+		lvremove -f $vg2/$lv1 
+		vgremove -f $vg2 
+		vgremove -f $vg1
+
+COMM "vgsplit correctly splits single striped LV into $i VG ($j args)"
+		vgcreate $vg1 $dev1 $dev2 
+		if [ $i == existing ]; then
+		   vgcreate $vg2 $dev3 $dev4
+		fi 
+		lvcreate -l 4 -i 2 -n $lv1 $vg1 $dev1 $dev2 
+		vgchange -an $vg1 
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev1 $dev2
+		else
+		  vgsplit -n $lv1 $vg1 $vg2
+		fi 
+		if [ $i == existing ]; then
+		  aux vg_validate_pvlv_counts_ $vg2 4 1 0
+		else
+		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
+		fi 
+		lvremove -f $vg2/$lv1 
+		vgremove -f $vg2
+
+COMM "vgsplit correctly splits mirror LV into $i VG ($j args)" 
+		vgcreate $vg1 $dev1 $dev2 $dev3 
+		if [ $i == existing ]; then
+		  vgcreate $vg2 $dev4
+		fi 
+		lvcreate -l 64 -m1 -n $lv1 $vg1 $dev1 $dev2 $dev3 
+		vgchange -an $vg1 
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev1 $dev2 $dev3
+		else
+		  vgsplit -n $lv1 $vg1 $vg2
+		fi 
+		if [ $i == existing ]; then
+		  aux vg_validate_pvlv_counts_ $vg2 4 1 0
+		else
+		  aux vg_validate_pvlv_counts_ $vg2 3 1 0
+		fi 
+		lvremove -f $vg2/$lv1 
+		vgremove -f $vg2
+
+COMM "vgsplit correctly splits origin and snapshot LV into $i VG ($j args)" 
+		vgcreate $vg1 $dev1 $dev2 
+		if [ $i == existing ]; then
+		  vgcreate $vg2 $dev3 $dev4
+		fi 
+		lvcreate -l 64 -i 2 -n $lv1 $vg1 $dev1 $dev2 
+		lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 
+		vgchange -an $vg1 
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev1 $dev2
+		else
+		  vgsplit -n $lv1 $vg1 $vg2
+		fi 
+		if [ $i == existing ]; then
+		  aux vg_validate_pvlv_counts_ $vg2 4 2 1
+		else
+		  aux vg_validate_pvlv_counts_ $vg2 2 2 1
+		fi 
+		lvremove -f $vg2/$lv2 
+		lvremove -f $vg2/$lv1 
+		vgremove -f $vg2
+
+COMM "vgsplit correctly splits linear LV but not snap+origin LV into $i VG ($j args)" 
+		vgcreate $vg1 $dev1 $dev2 
+		if [ $i == existing ]; then
+		  vgcreate $vg2 $dev3
+		fi 
+		lvcreate -l 64 -i 2 -n $lv1 $vg1 
+		lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 
+		vgextend $vg1 $dev4 
+		lvcreate -l 64 -n $lv3 $vg1 $dev4 
+		vgchange -an $vg1 
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev4
+		else
+		  vgsplit -n $lv3 $vg1 $vg2
+		fi 
+		if [ $i == existing ]; then
+		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
+		  aux vg_validate_pvlv_counts_ $vg1 2 2 1
+		else
+		  aux vg_validate_pvlv_counts_ $vg2 1 1 0
+		  aux vg_validate_pvlv_counts_ $vg1 2 2 1
+		fi 
+		lvremove -f $vg1/$lv2 
+		lvremove -f $vg1/$lv1 
+		lvremove -f $vg2/$lv3 
+		vgremove -f $vg1 
+		vgremove -f $vg2
+
+COMM "vgsplit correctly splits linear LV but not mirror LV into $i VG ($j args)" 
+		vgcreate $vg1 $dev1 $dev2 $dev3 
+		if [ $i == existing ]; then
+		  vgcreate $vg2 $dev5
+		fi 
+		lvcreate -l 64 -m1 -n $lv1 $vg1 $dev1 $dev2 $dev3 
+		vgextend $vg1 $dev4 
+		lvcreate -l 64 -n $lv2 $vg1 $dev4 
+		vgchange -an $vg1 
+		vgs
+		lvs 
+		pvs
+		if [ $j == PV ]; then
+		  vgsplit $vg1 $vg2 $dev4
+		else
+		  vgsplit -n $lv2 $vg1 $vg2
+		fi 
+		if [ $i == existing ]; then
+		  aux vg_validate_pvlv_counts_ $vg1 3 1 0
+		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
+		else
+		vgs
+		lvs 
+		pvs
+		  aux vg_validate_pvlv_counts_ $vg1 3 1 0
+		  aux vg_validate_pvlv_counts_ $vg2 1 1 0
+		fi 
+		lvremove -f $vg1/$lv1 
+		lvremove -f $vg2/$lv2 
+		vgremove -f $vg1 
+		vgremove -f $vg2
 
-done
+	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=$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 3 2 &&
-   vgchange -an $vg1 &&
-   vgsplit -n $lv1 $vg1 $vg2;
-   status=$?; echo status=$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 3 2 &&
-   vgchange -an $vg1 &&
-   vgsplit -n $lv2 $vg1 $vg2;
-   status=$?; echo status=$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=$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 2 0 &&
-   vgchange -an $vg1 &&
-   vgsplit -n $lv2 $vg1 $vg2 2>err;
-   status=$?; echo status=$status; test $status = 5 &&
-   vgremove -ff $vg1'
+COMM "vgsplit fails splitting 3 striped LVs into VG when only 1 LV specified" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 4 -n $lv1 -i 2 $vg1 $dev1 $dev2 
+lvcreate -l 4 -n $lv2 -i 2 $vg1 $dev2 $dev3 
+lvcreate -l 4 -n $lv3 -i 2 $vg1 $dev3 $dev4 
+vgchange -an $vg1 
+not vgsplit -n $lv1 $vg1 $vg2
+vgremove -ff $vg1
+
+COMM "vgsplit fails splitting one LV with 2 snapshots, only origin LV specified" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2 
+lvcreate -l 4 -n $lv2 -s $vg1/$lv1 
+lvcreate -l 4 -n $lv3 -s $vg1/$lv1 
+vg_validate_pvlv_counts_ $vg1 4 3 2 
+vgchange -an $vg1 
+not vgsplit -n $lv1 $vg1 $vg2;
+lvremove -f $vg1/$lv2 
+lvremove -f $vg1/$lv3 
+lvremove -f $vg1/$lv1 
+vgremove -ff $vg1
+
+COMM "vgsplit fails splitting one LV with 2 snapshots, only snapshot LV specified" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2 
+lvcreate -l 4 -n $lv2 -s $vg1/$lv1 
+lvcreate -l 4 -n $lv3 -s $vg1/$lv1 
+vg_validate_pvlv_counts_ $vg1 4 3 2 
+vgchange -an $vg1 
+not vgsplit -n $lv2 $vg1 $vg2
+lvremove -f $vg1/$lv2 
+lvremove -f $vg1/$lv3 
+lvremove -f $vg1/$lv1 
+vgremove -ff $vg1
+
+COMM "vgsplit fails splitting one mirror LV, only one PV specified" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3 
+vg_validate_pvlv_counts_ $vg1 4 1 0 
+vgchange -an $vg1 
+not vgsplit $vg1 $vg2 $dev2 
+vgremove -ff $vg1
+
+COMM "vgsplit fails splitting 1 mirror + 1 striped LV, only striped LV specified" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3 
+lvcreate -l 16 -n $lv2 -i 2 $vg1 $dev3 $dev4 
+vg_validate_pvlv_counts_ $vg1 4 2 0 
+vgchange -an $vg1 
+not vgsplit -n $lv2 $vg1 $vg2 2>err
+vgremove -ff $vg1
 
 #
 # Verify vgsplit rejects active LVs only when active LVs involved in split
 #
-test_expect_success \
-  "vgsplit fails, active mirror involved in split" \
-  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
-   lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 &&
-   lvcreate -l 16 -n $lv2 $vg1 $d4 &&
-   lvchange -an $vg1/$lv2 &&
-   vg_validate_pvlv_counts_ $vg1 4 2 0 &&
-   vgsplit -n $lv1 $vg1 $vg2;
-   status=$?; echo status=$status; test $status = 5 &&
-   vg_validate_pvlv_counts_ $vg1 4 2 0 &&
-   vgremove -ff $vg1'
-
-test_expect_success \
-  "vgsplit succeeds, active mirror not involved in split" \
-  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
-   lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 &&
-   lvcreate -l 16 -n $lv2 $vg1 $d4 &&
-   lvchange -an $vg1/$lv2 &&
-   vg_validate_pvlv_counts_ $vg1 4 2 0 &&
-   vgsplit -n $lv2 $vg1 $vg2 &&
-   vg_validate_pvlv_counts_ $vg1 3 1 0 &&
-   vg_validate_pvlv_counts_ $vg2 1 1 0 &&
-   vgremove -ff $vg1 &&
-   vgremove -ff $vg2'
-
-test_expect_success \
-  "vgsplit fails, active snapshot involved in split" \
-  'vgcreate $vg1 $d1 $d2 $d3 $d4 &&
-   lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 &&
-   lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 &&
-   lvcreate -l 64 -i 2 -n $lv3 $vg1 $d3 $d4 &&
-   lvchange -an $vg1/$lv3 &&
-   vg_validate_pvlv_counts_ $vg1 4 3 1 &&
-   vgsplit -n $lv2 $vg1 $vg2;
-   status=$?; echo status=$status; test $status = 5 &&
-   vg_validate_pvlv_counts_ $vg1 4 3 1 &&
-   lvremove -f $vg1/$lv2 &&
-   vgremove -ff $vg1'
-
-test_expect_success \
-  "vgsplit succeeds, active snapshot not involved in split" \
-  'vgcreate $vg1 $d1 $d2 $d3 &&
-   lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 &&
-   lvcreate -l 4 -s -n $lv2 $vg1/$lv1 &&
-   vgextend $vg1 $d4 &&
-   lvcreate -l 64 -n $lv3 $vg1 $d4 &&
-   lvchange -an $vg1/$lv3 &&
-   vg_validate_pvlv_counts_ $vg1 4 3 1 &&
-   vgsplit -n $lv3 $vg1 $vg2 &&
-   vg_validate_pvlv_counts_ $vg1 3 2 1 &&
-   vg_validate_pvlv_counts_ $vg2 1 1 0 &&
-   vgchange -an $vg1 &&
-   lvremove -f $vg1/$lv2 &&
-   vgremove -ff $vg1 &&
-   vgremove -ff $vg2'
-
-
-test_done
-
-# Local Variables:
-# indent-tabs-mode: nil
-# End:
+COMM "vgsplit fails, active mirror involved in split" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3 
+lvcreate -l 16 -n $lv2 $vg1 $dev4 
+lvchange -an $vg1/$lv2 
+vg_validate_pvlv_counts_ $vg1 4 2 0 
+not vgsplit -n $lv1 $vg1 $vg2;
+vg_validate_pvlv_counts_ $vg1 4 2 0 
+vgremove -ff $vg1
+
+COMM "vgsplit succeeds, active mirror not involved in split" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3 
+lvcreate -l 16 -n $lv2 $vg1 $dev4 
+lvchange -an $vg1/$lv2 
+vg_validate_pvlv_counts_ $vg1 4 2 0 
+vgsplit -n $lv2 $vg1 $vg2 
+vg_validate_pvlv_counts_ $vg1 3 1 0 
+vg_validate_pvlv_counts_ $vg2 1 1 0 
+vgremove -ff $vg1 
+vgremove -ff $vg2
+
+COMM "vgsplit fails, active snapshot involved in split" 
+vgcreate $vg1 $dev1 $dev2 $dev3 $dev4 
+lvcreate -l 64 -i 2 -n $lv1 $vg1 $dev1 $dev2 
+lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 
+lvcreate -l 64 -i 2 -n $lv3 $vg1 $dev3 $dev4 
+lvchange -an $vg1/$lv3 
+vg_validate_pvlv_counts_ $vg1 4 3 1 
+not vgsplit -n $lv2 $vg1 $vg2;
+vg_validate_pvlv_counts_ $vg1 4 3 1 
+lvremove -f $vg1/$lv2 
+vgremove -ff $vg1
+
+COMM "vgsplit succeeds, active snapshot not involved in split" 
+vgcreate $vg1 $dev1 $dev2 $dev3 
+lvcreate -l 64 -i 2 -n $lv1 $vg1 $dev1 $dev2 
+lvcreate -l 4 -s -n $lv2 $vg1/$lv1 
+vgextend $vg1 $dev4 
+lvcreate -l 64 -n $lv3 $vg1 $dev4 
+lvchange -an $vg1/$lv3 
+vg_validate_pvlv_counts_ $vg1 4 3 1 
+vgsplit -n $lv3 $vg1 $vg2 
+vg_validate_pvlv_counts_ $vg1 3 2 1 
+vg_validate_pvlv_counts_ $vg2 1 1 0 
+vgchange -an $vg1 
+lvremove -f $vg1/$lv2 
+vgremove -ff $vg1 
+vgremove -ff $vg2
+


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2010-03-29 16:40 mornfall
  0 siblings, 0 replies; 11+ messages in thread
From: mornfall @ 2010-03-29 16:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-03-29 16:40:51

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Enforce distinct-PV allocation of snapshot/origin pairs in vgsplit test.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.24&r2=1.25

--- LVM2/test/t-vgsplit-operation.sh	2009/12/28 18:33:04	1.24
+++ LVM2/test/t-vgsplit-operation.sh	2010/03/29 16:40:51	1.25
@@ -195,8 +195,8 @@
 COMM "vgsplit fails splitting one LV with 2 snapshots, only origin LV specified" 
 vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4 
 lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2 
-lvcreate -l 4 -n $lv2 -s $vg1/$lv1 
-lvcreate -l 4 -n $lv3 -s $vg1/$lv1 
+lvcreate -l 4 -n $lv2 -s $vg1/$lv1 $dev3
+lvcreate -l 4 -n $lv3 -s $vg1/$lv1 $dev4
 vg_validate_pvlv_counts_ $vg1 4 3 2 
 vgchange -an $vg1 
 not vgsplit -n $lv1 $vg1 $vg2;
@@ -208,8 +208,8 @@
 COMM "vgsplit fails splitting one LV with 2 snapshots, only snapshot LV specified" 
 vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4 
 lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2 
-lvcreate -l 4 -n $lv2 -s $vg1/$lv1 
-lvcreate -l 4 -n $lv3 -s $vg1/$lv1 
+lvcreate -l 4 -n $lv2 -s $vg1/$lv1 $dev3
+lvcreate -l 4 -n $lv3 -s $vg1/$lv1 $dev4
 vg_validate_pvlv_counts_ $vg1 4 3 2 
 vgchange -an $vg1 
 not vgsplit -n $lv2 $vg1 $vg2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-09-30 18:29 mornfall
  0 siblings, 0 replies; 11+ messages in thread
From: mornfall @ 2008-09-30 18:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-09-30 18:29:10

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Fix [ a = b ] usage in t-vgsplit-operation: string comparison is '=', not '=='.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.22&r2=1.23

--- LVM2/test/t-vgsplit-operation.sh	2008/09/30 17:56:54	1.22
+++ LVM2/test/t-vgsplit-operation.sh	2008/09/30 18:29:10	1.23
@@ -34,18 +34,18 @@
 	do
 COMM "vgsplit correctly splits single linear LV into $i VG ($j args)"
 		vgcreate $vg1 $dev1 $dev2 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		   vgcreate $vg2 $dev3 $dev4
 		fi 
 		lvcreate -l 4 -n $lv1 $vg1 $dev1 
 		vgchange -an $vg1 
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev1
 		else
 		  vgsplit -n $lv1 $vg1 $vg2
 		fi 
 		vg_validate_pvlv_counts_ $vg1 1 0 0 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		   aux vg_validate_pvlv_counts_ $vg2 3 1 0
 		else
 		   aux vg_validate_pvlv_counts_ $vg2 1 1 0
@@ -56,17 +56,17 @@
 
 COMM "vgsplit correctly splits single striped LV into $i VG ($j args)"
 		vgcreate $vg1 $dev1 $dev2 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		   vgcreate $vg2 $dev3 $dev4
 		fi 
 		lvcreate -l 4 -i 2 -n $lv1 $vg1 $dev1 $dev2 
 		vgchange -an $vg1 
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev1 $dev2
 		else
 		  vgsplit -n $lv1 $vg1 $vg2
 		fi 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  aux vg_validate_pvlv_counts_ $vg2 4 1 0
 		else
 		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
@@ -76,17 +76,17 @@
 
 COMM "vgsplit correctly splits mirror LV into $i VG ($j args)" 
 		vgcreate $vg1 $dev1 $dev2 $dev3 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  vgcreate $vg2 $dev4
 		fi 
 		lvcreate -l 64 -m1 -n $lv1 $vg1 $dev1 $dev2 $dev3 
 		vgchange -an $vg1 
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev1 $dev2 $dev3
 		else
 		  vgsplit -n $lv1 $vg1 $vg2
 		fi 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  aux vg_validate_pvlv_counts_ $vg2 4 1 0
 		else
 		  aux vg_validate_pvlv_counts_ $vg2 3 1 0
@@ -96,18 +96,18 @@
 
 COMM "vgsplit correctly splits origin and snapshot LV into $i VG ($j args)" 
 		vgcreate $vg1 $dev1 $dev2 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  vgcreate $vg2 $dev3 $dev4
 		fi 
 		lvcreate -l 64 -i 2 -n $lv1 $vg1 $dev1 $dev2 
 		lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 
 		vgchange -an $vg1 
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev1 $dev2
 		else
 		  vgsplit -n $lv1 $vg1 $vg2
 		fi 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  aux vg_validate_pvlv_counts_ $vg2 4 2 1
 		else
 		  aux vg_validate_pvlv_counts_ $vg2 2 2 1
@@ -118,7 +118,7 @@
 
 COMM "vgsplit correctly splits linear LV but not snap+origin LV into $i VG ($j args)" 
 		vgcreate $vg1 $dev1 $dev2 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  vgcreate $vg2 $dev3
 		fi 
 		lvcreate -l 64 -i 2 -n $lv1 $vg1 
@@ -126,12 +126,12 @@
 		vgextend $vg1 $dev4 
 		lvcreate -l 64 -n $lv3 $vg1 $dev4 
 		vgchange -an $vg1 
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev4
 		else
 		  vgsplit -n $lv3 $vg1 $vg2
 		fi 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
 		  aux vg_validate_pvlv_counts_ $vg1 2 2 1
 		else
@@ -146,7 +146,7 @@
 
 COMM "vgsplit correctly splits linear LV but not mirror LV into $i VG ($j args)" 
 		vgcreate $vg1 $dev1 $dev2 $dev3 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  vgcreate $vg2 $dev5
 		fi 
 		lvcreate -l 64 -m1 -n $lv1 $vg1 $dev1 $dev2 $dev3 
@@ -156,12 +156,12 @@
 		vgs
 		lvs 
 		pvs
-		if [ $j == PV ]; then
+		if [ $j = PV ]; then
 		  vgsplit $vg1 $vg2 $dev4
 		else
 		  vgsplit -n $lv2 $vg1 $vg2
 		fi 
-		if [ $i == existing ]; then
+		if [ $i = existing ]; then
 		  aux vg_validate_pvlv_counts_ $vg1 3 1 0
 		  aux vg_validate_pvlv_counts_ $vg2 2 1 0
 		else


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-04-10 18:55 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-04-10 18:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-10 18:55:41

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Update vgsplit tests that count LVs for adjusted LV counting.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.18&r2=1.19

--- LVM2/test/t-vgsplit-operation.sh	2008/04/10 01:06:48	1.18
+++ LVM2/test/t-vgsplit-operation.sh	2008/04/10 18:55:40	1.19
@@ -121,9 +121,9 @@
      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 0
    else
-     vg_validate_pvlv_counts_ $vg2 3 4 0
+     vg_validate_pvlv_counts_ $vg2 3 1 0
    fi &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
@@ -143,9 +143,9 @@
      vgsplit -n $lv1 $vg1 $vg2
    fi &&
    if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg2 4 1 1
+     vg_validate_pvlv_counts_ $vg2 4 2 1
    else
-     vg_validate_pvlv_counts_ $vg2 2 1 1
+     vg_validate_pvlv_counts_ $vg2 2 2 1
    fi &&
    lvremove -f $vg2/$lv2 &&
    lvremove -f $vg2/$lv1 &&
@@ -169,10 +169,10 @@
    fi &&
    if [ $i == existing ]; then
      vg_validate_pvlv_counts_ $vg2 2 1 0
-     vg_validate_pvlv_counts_ $vg1 2 1 1
+     vg_validate_pvlv_counts_ $vg1 2 2 1
    else
      vg_validate_pvlv_counts_ $vg2 1 1 0
-     vg_validate_pvlv_counts_ $vg1 2 1 1
+     vg_validate_pvlv_counts_ $vg1 2 2 1
    fi &&
    lvremove -f $vg1/$lv2 &&
    lvremove -f $vg1/$lv1 &&
@@ -196,10 +196,10 @@
      vgsplit -n $lv2 $vg1 $vg2
    fi &&
    if [ $i == existing ]; then
-     vg_validate_pvlv_counts_ $vg1 3 4 0
+     vg_validate_pvlv_counts_ $vg1 3 2 0
      vg_validate_pvlv_counts_ $vg2 2 1 0
    else
-     vg_validate_pvlv_counts_ $vg1 3 4 0
+     vg_validate_pvlv_counts_ $vg1 3 2 0
      vg_validate_pvlv_counts_ $vg2 1 1 0
    fi &&
    lvremove -f $vg1/$lv1 &&
@@ -231,7 +231,7 @@
    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 &&
+   vg_validate_pvlv_counts_ $vg1 4 3 2 &&
    vgchange -an $vg1 &&
    vgsplit -n $lv1 $vg1 $vg2;
    status=$?; echo status=$status; test $status = 5 &&
@@ -246,7 +246,7 @@
    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 &&
+   vg_validate_pvlv_counts_ $vg1 4 3 2 &&
    vgchange -an $vg1 &&
    vgsplit -n $lv2 $vg1 $vg2;
    status=$?; echo status=$status; test $status = 5 &&
@@ -270,7 +270,7 @@
   '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 &&
+   vg_validate_pvlv_counts_ $vg1 4 2 0 &&
    vgchange -an $vg1 &&
    vgsplit -n $lv2 $vg1 $vg2 2>err;
    status=$?; echo status=$status; test $status = 5 &&


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-04-09 21:10 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-04-09 21:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-09 21:10:13

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Add vgsplit tests to verify mirror is not moved unnecessarily.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.16&r2=1.17

--- LVM2/test/t-vgsplit-operation.sh	2008/04/09 20:56:06	1.16
+++ LVM2/test/t-vgsplit-operation.sh	2008/04/09 21:10:13	1.17
@@ -20,7 +20,8 @@
   test -n "$d2" && losetup -d "$d2"
   test -n "$d3" && losetup -d "$d3"
   test -n "$d4" && losetup -d "$d4"
-  rm -f "$f1" "$f2" "$f3" "$f4"
+  test -n "$d5" && losetup -d "$d5"
+  rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
 }
 
 vg_validate_pvlv_counts_()
@@ -44,12 +45,13 @@
    f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
    f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
    f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
+   f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
    vg1=$(this_test_)-test-vg1-$$          &&
    vg2=$(this_test_)-test-vg2-$$          &&
    lv1=$(this_test_)-test-lv1-$$          &&
    lv2=$(this_test_)-test-lv2-$$          &&
    lv3=$(this_test_)-test-lv3-$$          &&
-   pvcreate $d1 $d2 $d3 $d4'
+   pvcreate $d1 $d2 $d3 $d4 $d5'
 
 #
 # vgsplit can be done into a new or existing VG
@@ -178,6 +180,33 @@
    vgremove -f $vg1 &&
    vgremove -f $vg2'
 
+test_expect_success \
+  "vgsplit correctly splits linear LV but not mirror LV into $i VG ($j args)" \
+  'vgcreate $vg1 $d1 $d2 $d3 &&
+   if [ $i == existing ]; then
+     vgcreate $vg2 $d5
+   fi &&
+   lvcreate -l 64 -m1 -n $lv1 $vg1 $d1 $d2 $d3 &&
+   vgextend $vg1 $d4 &&
+   lvcreate -l 64 -n $lv2 $vg1 $d4 &&
+   vgchange -an $vg1 &&
+   if [ $j == PV ]; then
+     vgsplit $vg1 $vg2 $d4
+   else
+     vgsplit -n $lv2 $vg1 $vg2
+   fi &&
+   if [ $i == existing ]; then
+     vg_validate_pvlv_counts_ $vg1 3 4 0
+     vg_validate_pvlv_counts_ $vg2 2 1 0
+   else
+     vg_validate_pvlv_counts_ $vg1 3 4 0
+     vg_validate_pvlv_counts_ $vg2 1 1 0
+   fi &&
+   lvremove -f $vg1/$lv1 &&
+   lvremove -f $vg2/$lv2 &&
+   vgremove -f $vg1 &&
+   vgremove -f $vg2'
+
 done
 done
 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-03-21 21:14 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-03-21 21:14 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-03-21 21:14:39

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Update vgsplit tests to execute twice (existing and new VG as destination).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.12&r2=1.13

--- LVM2/test/t-vgsplit-operation.sh	2008/03/04 22:49:00	1.12
+++ LVM2/test/t-vgsplit-operation.sh	2008/03/21 21:14:38	1.13
@@ -23,7 +23,7 @@
   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 @@
    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:


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-03-04 22:49 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-03-04 22:49 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-03-04 22:49:00

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Update vgsplit tests.
	- Add validation on pv_count, lv_count, and snap_count after split
	NOTE: Some of these counts are misleading.  If you compare "lvs" output
	with these counts you will be left scratching your head what a "logical volume"
	really is.  ;-)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12

--- LVM2/test/t-vgsplit-operation.sh	2008/03/04 19:48:32	1.11
+++ LVM2/test/t-vgsplit-operation.sh	2008/03/04 22:49:00	1.12
@@ -23,6 +23,18 @@
   rm -f "$f1" "$f2" "$f3" "$f4"
 }
 
+validate_vg_pvlv_counts_()
+{
+	local local_vg=$1
+	local num_pvs=$2
+	local num_lvs=$3
+	local num_snaps=$4
+
+	check_vg_field_ $local_vg pv_count $num_pvs &&
+	check_vg_field_ $local_vg lv_count $num_lvs &&
+	check_vg_field_ $local_vg snap_count $num_snaps
+}
+
 # FIXME: paramaterize lvm1 vs lvm2 metadata; most of these tests should run
 # fine with lvm1 metadata as well; for now, just add disks 5 and 6 as lvm1
 # metadata
@@ -46,6 +58,8 @@
    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 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2 &&
    vgremove -f $vg1'
@@ -57,6 +71,7 @@
    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 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
 
@@ -68,6 +83,7 @@
    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 &&
    lvremove -f $vg2/$lv2 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
@@ -79,6 +95,7 @@
    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 &&
    lvremove -f $vg2/$lv1 &&
    vgremove -f $vg2'
 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-02-29  0:09 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-02-29  0:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-02-29 00:09:21

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Add vgsplit test to check failure when PV not in source volume group.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10

--- LVM2/test/t-vgsplit-operation.sh	2008/02/28 17:39:47	1.9
+++ LVM2/test/t-vgsplit-operation.sh	2008/02/29 00:09:21	1.10
@@ -163,6 +163,19 @@
    vgremove -f $vg2 &&
    vgremove -f $vg1'
 
+test_expect_success \
+  'vgsplit rejects split because PV not in VG' \
+  'vgcreate $vg1 $d1 $d2 &&
+   vgcreate $vg2 $d3 $d4 &&
+   lvcreate -l 4 -n $lv1 $vg1 &&
+   lvcreate -l 4 -n $lv2 $vg1 &&
+   vgchange -an $vg1 &&
+   vgsplit $vg1 $vg2 $d3 2>err;
+   status=$?; echo status=$?; test $status = 5 &&
+   grep "^  Physical volume $d3 not in volume group $vg1" err &&
+   vgremove -f $vg2 &&
+   vgremove -f $vg1'
+
 test_done
 # Local Variables:
 # indent-tabs-mode: nil


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-02-28 17:39 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-02-28 17:39 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-02-28 17:39:47

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Fix t-vgsplit-operation.sh lv2-3 definitions to include test signature.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/test/t-vgsplit-operation.sh	2008/02/28 16:48:09	1.8
+++ LVM2/test/t-vgsplit-operation.sh	2008/02/28 17:39:47	1.9
@@ -35,6 +35,8 @@
    vg1=$(this_test_)-test-vg1-$$          &&
    vg2=$(this_test_)-test-vg2-$$          &&
    lv1=$(this_test_)-test-lv1-$$          &&
+   lv2=$(this_test_)-test-lv2-$$          &&
+   lv3=$(this_test_)-test-lv3-$$          &&
    pvcreate $d1 $d2 $d3 $d4'
 
 test_expect_success \
@@ -151,8 +153,8 @@
   'vgcreate --maxlogicalvolumes 2 $vg1 $d1 $d2 &&
    vgcreate --maxlogicalvolumes 2 $vg2 $d3 $d4 &&
    lvcreate -l 4 -n $lv1 $vg1 &&
-   lvcreate -l 4 -n lv2 $vg1 &&
-   lvcreate -l 4 -n lv3 $vg2 &&
+   lvcreate -l 4 -n $lv2 $vg1 &&
+   lvcreate -l 4 -n $lv3 $vg2 &&
    vgchange -an $vg1 &&
    vgchange -an $vg2 &&
    vgsplit $vg1 $vg2 $d1 2>err;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-02-28 16:48 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-02-28 16:48 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-02-28 16:48:11

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Fix t-vgsplit-operation.sh lv1 definition to include test signature.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.7&r2=1.8

--- LVM2/test/t-vgsplit-operation.sh	2008/01/22 03:30:14	1.7
+++ LVM2/test/t-vgsplit-operation.sh	2008/02/28 16:48:09	1.8
@@ -34,6 +34,7 @@
    f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
    vg1=$(this_test_)-test-vg1-$$          &&
    vg2=$(this_test_)-test-vg2-$$          &&
+   lv1=$(this_test_)-test-lv1-$$          &&
    pvcreate $d1 $d2 $d3 $d4'
 
 test_expect_success \
@@ -138,7 +139,7 @@
   'pvcreate -ff -M2 $d3 $d4 &&
    vgcreate $vg1 $d1 $d2 &&
    vgcreate $vg2 $d3 $d4 &&
-   lvcreate -l 4 -n lv1 $vg1 &&
+   lvcreate -l 4 -n $lv1 $vg1 &&
    vgsplit $vg1 $vg2 $d1 2>err;
    status=$?; echo status=$?; test $status = 5 &&
    grep "^  Logical volumes in \"$vg1\" must be inactive\$" err &&
@@ -149,7 +150,7 @@
   'vgsplit rejects split because max_lv is exceeded' \
   'vgcreate --maxlogicalvolumes 2 $vg1 $d1 $d2 &&
    vgcreate --maxlogicalvolumes 2 $vg2 $d3 $d4 &&
-   lvcreate -l 4 -n lv1 $vg1 &&
+   lvcreate -l 4 -n $lv1 $vg1 &&
    lvcreate -l 4 -n lv2 $vg1 &&
    lvcreate -l 4 -n lv3 $vg2 &&
    vgchange -an $vg1 &&


^ permalink raw reply	[flat|nested] 11+ messages in thread

* LVM2/test t-vgsplit-operation.sh
@ 2008-01-22  3:30 wysochanski
  0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2008-01-22  3:30 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-01-22 03:30:14

Modified files:
	test           : t-vgsplit-operation.sh 

Log message:
	Fix vgsplit tests 12-13

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/test/t-vgsplit-operation.sh	2008/01/22 03:25:45	1.6
+++ LVM2/test/t-vgsplit-operation.sh	2008/01/22 03:30:14	1.7
@@ -135,7 +135,8 @@
 
 test_expect_success \
   'vgsplit rejects vg with active lv' \
-  'vgcreate $vg1 $d1 $d2 &&
+  'pvcreate -ff -M2 $d3 $d4 &&
+   vgcreate $vg1 $d1 $d2 &&
    vgcreate $vg2 $d3 $d4 &&
    lvcreate -l 4 -n lv1 $vg1 &&
    vgsplit $vg1 $vg2 $d1 2>err;


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-03-29 16:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-30 17:56 LVM2/test t-vgsplit-operation.sh mornfall
  -- strict thread matches above, loose matches on Subject: below --
2010-03-29 16:40 mornfall
2008-09-30 18:29 mornfall
2008-04-10 18:55 wysochanski
2008-04-09 21:10 wysochanski
2008-03-21 21:14 wysochanski
2008-03-04 22:49 wysochanski
2008-02-29  0:09 wysochanski
2008-02-28 17:39 wysochanski
2008-02-28 16:48 wysochanski
2008-01-22  3:30 wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).