public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/test t-snapshot-merge.sh
@ 2010-01-19 22:55 snitzer
  0 siblings, 0 replies; 2+ messages in thread
From: snitzer @ 2010-01-19 22:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2010-01-19 22:55:01

Added files:
	test           : t-snapshot-merge.sh 

Log message:
	add test/t-snapshot-merge.sh to provide coverage of snapshot-merge support

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-snapshot-merge.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1

/cvs/lvm2/LVM2/test/t-snapshot-merge.sh,v  -->  standard output
revision 1.1
--- LVM2/test/t-snapshot-merge.sh
+++ -	2010-01-19 22:55:01.316265000 +0000
@@ -0,0 +1,91 @@
+#!/bin/sh
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+set -xv
+
+which mkfs.ext3 || exit 200
+
+. ./test-utils.sh
+
+lvdev_()
+{
+    echo "$G_dev_/$1/$2"
+}
+
+snap_lv_name_() {
+    echo ${1}_snap
+}
+
+setup_merge() {
+    local VG_NAME=$1
+    local LV_NAME=$2
+    local NUM_EXTRA_SNAPS="$3"
+    test -z "$NUM_EXTRA_SNAPS" && NUM_EXTRA_SNAPS=0
+    local BASE_SNAP_LV_NAME=$(snap_lv_name_ $LV_NAME)
+
+    lvcreate -n $LV_NAME -l 50%FREE $VG_NAME
+    lvcreate -s -n $BASE_SNAP_LV_NAME -l 20%FREE ${VG_NAME}/${LV_NAME}
+    mkfs.ext3 $(lvdev_ $VG_NAME $LV_NAME)
+
+    if [ $NUM_EXTRA_SNAPS -gt 0 ]; then
+	for i in `seq 1 $NUM_EXTRA_SNAPS`; do
+	    lvcreate -s -n ${BASE_SNAP_LV_NAME}_${i} -l 20%FREE ${VG_NAME}/${LV_NAME}
+	done
+    fi
+}
+
+aux prepare_vg 1 100
+
+
+# full merge of a single LV
+setup_merge $vg $lv1
+
+# now that snapshot LV is created: test if snapshot-merge target is available
+$(dmsetup targets | grep -q snapshot-merge) || exit 200
+
+lvs -a
+lvconvert --merge $vg/$(snap_lv_name_ $lv1)
+lvremove -f $vg/$lv1
+
+
+# "onactivate merge" test -- refresh LV while FS is still mounted;
+# verify snapshot-origin target is still being used
+setup_merge $vg $lv1
+lvs -a
+mkdir test_mnt
+mount $(lvdev_ $vg $lv1) test_mnt
+lvconvert --merge $vg/$(snap_lv_name_ $lv1)
+lvchange --refresh $vg/$lv1
+umount test_mnt
+rm -r test_mnt
+# an active merge uses the "snapshot-merge" target
+dmsetup table ${vg}-${lv1} | grep -q " snapshot-origin "
+test $? = 0
+lvremove -f $vg/$lv1
+
+
+# test multiple snapshot merge; tests copy out that is driven by merge
+setup_merge $vg $lv1 1
+lvs -a
+lvconvert --merge $vg/$(snap_lv_name_ $lv1)
+lvremove -f $vg/$lv1
+
+
+# FIXME following tests would need to poll merge progress, via periodic lvs?
+# Background processes don't lend themselves to lvm testsuite...
+
+# test: onactivate merge of a single lv
+
+# test: do onactivate, deactivate the origin LV, reactivate the LV, merge should resume
+
+# test: multiple onactivate merge
+
+
+vgremove -f "$vg"


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

* LVM2/test t-snapshot-merge.sh
@ 2010-04-19 22:44 snitzer
  0 siblings, 0 replies; 2+ messages in thread
From: snitzer @ 2010-04-19 22:44 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2010-04-19 22:44:42

Modified files:
	test           : t-snapshot-merge.sh 

Log message:
	Add additional test to start the snapshot merge (which had just failed
	because an FS was mounted -- origin was still open).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-snapshot-merge.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4

--- LVM2/test/t-snapshot-merge.sh	2010/04/07 14:46:26	1.3
+++ LVM2/test/t-snapshot-merge.sh	2010/04/19 22:44:42	1.4
@@ -55,19 +55,24 @@
 lvremove -f $vg/$lv1
 
 
-# "onactivate merge" test -- refresh LV while FS is still mounted;
-# verify snapshot-origin target is still being used
+# "onactivate merge" test
 setup_merge $vg $lv1
 lvs -a
 mkdir test_mnt
 mount $(lvdev_ $vg $lv1) test_mnt
 lvconvert --merge $vg/$(snap_lv_name_ $lv1)
+# -- refresh LV while FS is still mounted (merge must not start),
+#    verify 'snapshot-origin' target is still being used
 lvchange --refresh $vg/$lv1
 umount test_mnt
 rm -r test_mnt
-# an active merge uses the "snapshot-merge" target
 dmsetup table ${vg}-${lv1} | grep -q " snapshot-origin "
-test $? = 0
+# -- refresh LV to start merge (now that FS is unmounted),
+#    an active merge uses the 'snapshot-merge' target
+lvchange --refresh $vg/$lv1
+dmsetup table ${vg}-${lv1} | grep -q " snapshot-merge "
+# -- don't care if merge is still active; lvremove at this point
+#    may test stopping an active merge
 lvremove -f $vg/$lv1
 
 


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

end of thread, other threads:[~2010-04-19 22:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-19 22:55 LVM2/test t-snapshot-merge.sh snitzer
2010-04-19 22:44 snitzer

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).