master - tests: enhance snapshot test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=27d556de9e8952...
Commit: 27d556de9e895291f7c57b956cdb0036ff5d6e51
Parent: 1a0fea104b4d0d81f8fc6edd2802e025a9172d41
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 13:08:23 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:45 2014 +0100
tests: enhance snapshot test
Improve cleanup routine and use it also for vg removal.
---
test/shell/snapshot-usage.sh | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index 13be4ee..a50eeb2 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -20,7 +20,7 @@ fill() {
dd if=/dev/zero of="$DM_DEV_DIR/$vg1/lvol0" bs=$1 count=1
}
-# give some short time to lock file above
+# Wait until device is opened
wait_for_open_() {
for i in $(seq 1 50) ; do
test $(dmsetup info --noheadings -c -o open $1) -ne 0 && return
@@ -32,8 +32,10 @@ wait_for_open_() {
cleanup_tail()
{
- test -z "$SLEEP_PID" || kill $SLEEP_PID
+ test -z "$SLEEP_PID" || kill $SLEEP_PID || true
wait
+ vgremove -ff $vg1 || true
+ vgremove -ff $vg
aux teardown
}
@@ -69,22 +71,23 @@ aux extend_filter_LVMTEST
aux lvmconf "activation/snapshot_autoextend_percent = 20" \
"activation/snapshot_autoextend_threshold = 50"
-# Check usability with smallest extent size
+# Check usability with smallest (1k) extent size ($lv has 15P)
pvcreate --setphysicalvolumesize 4T "$DM_DEV_DIR/$vg/$lv"
+trap 'cleanup_tail' EXIT
vgcreate -s 1K $vg1 "$DM_DEV_DIR/$vg/$lv"
-# Test removal of opened snapshot
+# Test virtual snapshot over /dev/zero
lvcreate -V50 -L10 -n $lv1 -s $vg1
-
-lvs -a -o+lv_active $vg1
+CHECK_ACTIVE="active"
+test ! -e LOCAL_CLVMD || CHECK_ACTIVE="local exclusive"
+check lv_field $vg1/$lv1 lv_active ${CHECK_ACTIVE}
lvchange -an $vg1
-# Snapshot get exclusive activation
+# On cluster snapshot gets exclusive activation
lvchange -ay $vg1
-lvs -a -o+lv_active $vg1
+check lv_field $vg1/$lv1 lv_active ${CHECK_ACTIVE}
-trap 'cleanup_tail' EXIT
-# Keep device busy (but not mounted) for a while
+# Test removal of opened (bug unmounted) snapshot (device busy) for a while
sleep 120 < "$DM_DEV_DIR/$vg1/$lv1" &
SLEEP_PID=$!
@@ -100,17 +103,17 @@ SLEEP_PID=
wait
lvremove -f $vg1/$lv1
-not dmsetup info $vg1-$lv1 >/dev/null || \
- die "$vg1/$lv1 expected to be removed, but there are mappings!"
+check lv_not_exists $vg1 $lv1
# Check border size
lvcreate -aey -L4095G $vg1
lvcreate -s -L100K $vg1/lvol0
fill 1K
check lv_field $vg1/lvol1 data_percent "12.00"
+
lvremove -ff $vg1
-# Create 1KB snapshot, no need to be active active here
+# Create 1KB snapshot, does not need to be active here
lvcreate -an -Zn -l1 -n $lv1 $vg1
not lvcreate -s -l1 $vg1/$lv1
not lvcreate -s -l3 $vg1/$lv1
@@ -169,11 +172,11 @@ fsck -n "$DM_DEV_DIR/$vg1/snap"
# we have 2 valid results (unsure about correct version number)
check lv_field $vg1/snap data_percent "$EXPECT4"
-vgremove -ff $vg1
-
# Can't test >= 16T devices on 32bit
if test "$TSIZE" = 15P ; then
+vgremove -ff $vg1
+
# Check usability with largest extent size
pvcreate "$DM_DEV_DIR/$vg/$lv"
vgcreate -s 4G $vg1 "$DM_DEV_DIR/$vg/$lv"
@@ -186,8 +189,4 @@ lvremove -ff $vg1
lvcreate -V15E -l1 -n $lv1 -s $vg1
check lv_field $vg1/$lv1 origin_size "15.00e"
-vgremove -ff $vg1
-
fi
-
-vgremove -ff $vg
10 years, 2 months
master - tests: put test envvar into braces
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1a0fea104b4d0d...
Commit: 1a0fea104b4d0d81f8fc6edd2802e025a9172d41
Parent: 95f74af404411eff55f9e63dbb349adfac94dd59
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 09:35:59 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:45 2014 +0100
tests: put test envvar into braces
Ensure we not fail on space.
---
test/lib/test.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/test.sh b/test/lib/test.sh
index d7f6111..3bde1e3 100644
--- a/test/lib/test.sh
+++ b/test/lib/test.sh
@@ -42,7 +42,7 @@ cd "$TESTDIR"
if test -n "$LVM_TEST_FLAVOUR"; then
touch flavour_overrides
- env | grep ^$LVM_TEST_FLAVOUR | while read var; do
+ env | grep ^${LVM_TEST_FLAVOUR} | while read var; do
(echo -n "export "; echo $var | sed -e s,^${LVM_TEST_FLAVOUR}_,,) >> flavour_overrides
done
. flavour_overrides
10 years, 2 months
master - tests: skip mangling test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95f74af404411e...
Commit: 95f74af404411eff55f9e63dbb349adfac94dd59
Parent: 909e2207bd181141b423bc8b62992c761a0b8c35
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Mar 16 23:48:07 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:45 2014 +0100
tests: skip mangling test
Mangling is only using dmsetup commands,
so there is no lvm command and no contact with
clvmd nor lvmetad so skip this test there.
---
test/shell/name-mangling.sh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/shell/name-mangling.sh b/test/shell/name-mangling.sh
index cf218fe..fe54de4 100644
--- a/test/shell/name-mangling.sh
+++ b/test/shell/name-mangling.sh
@@ -11,6 +11,11 @@
. lib/test
+# This test is not using any lvm command
+# so skip duplicate CLMVD and lvmetad test
+test -e LOCAL_CLVMD && skip
+test -e LOCAL_LVMETAD && skip
+
CHARACTER_WHITELIST="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#+-.:=@_"
FAIL_MIXED_STR="contains mixed mangled and unmangled characters"
FAIL_MULTI_STR="seems to be mangled more than once"
10 years, 2 months
master - tests: test spare volume removal
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=909e2207bd1811...
Commit: 909e2207bd181141b423bc8b62992c761a0b8c35
Parent: 404593c710678082f7ff16efdfd1fe5394fb1bba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Mar 16 23:47:43 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:44 2014 +0100
tests: test spare volume removal
---
test/shell/lvcreate-thin.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index cfa605e..0873ce1 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -176,6 +176,9 @@ not lvcreate -L4M --chunksize 2G -T $vg/pool1
# Test creation of inactive pool
lvcreate -an -L4M -T $vg/pool1
lvcreate -V2G --name lv1 -T $vg/pool1
+# Check we are able remove spare volume if we want to
+lvremove -f $vg/lvol0_pmspare
+
# Origin name is not accepted
not lvcreate -s $vg/lv1 -L4M -V2G --name $vg/lv4
10 years, 2 months
master - tests: more coverage
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=404593c7106780...
Commit: 404593c710678082f7ff16efdfd1fe5394fb1bba
Parent: 7d3fa6fc32c1922d621a7a87ab81c0dc08679b10
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Mar 16 23:47:18 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:44 2014 +0100
tests: more coverage
---
test/shell/covercmd.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/shell/covercmd.sh b/test/shell/covercmd.sh
index f9a04e9..ca45c2f 100644
--- a/test/shell/covercmd.sh
+++ b/test/shell/covercmd.sh
@@ -30,7 +30,7 @@ lvcreate -l 5 -i5 -I256 -n $lv $vg
if aux have_readline; then
# test *scan and *display tools
cat <<EOF | lvm
-pvscan
+pvscan --uuid
vgscan
lvscan
lvmdiskscan
@@ -47,7 +47,7 @@ for i in h b s k m g t p e H B S K M G T P E; do
echo pvdisplay --units $i "$dev1"
done | lvm
else
-pvscan
+pvscan --uuid
vgscan
lvscan
lvmdiskscan
@@ -85,6 +85,7 @@ done
pvck "$dev1"
vgck $vg
+vgs -o all $vg
lvrename $vg $lv $lv-rename
vgcfgbackup -f backup.$$ $vg
vgchange -an $vg
10 years, 2 months
master - tests: skip more Fedora kernels for raid456
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7d3fa6fc32c192...
Commit: 7d3fa6fc32c1922d621a7a87ab81c0dc08679b10
Parent: 0fc17fe1ce02182e5c6f2e8abf4f22f8468e44f2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Mar 16 23:46:43 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:44 2014 +0100
tests: skip more Fedora kernels for raid456
---
test/lib/aux.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index bd292bb..12e8e04 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -681,8 +681,9 @@ raid456_replace_works() {
# so we need to put here exlusion for kernes which do trace SLUB
#
case $(uname -r) in
- 3.10.11-200.fc19.i686|3.10.11-200.fc19.x86_64) return 1 ;;
- 3.13.5-101.fc19.i686.PAE|3.13.6-200.fc20.x86_64) return 1 ;;
+ 3.1[0123].*.fc18.i686*|3.1[0123].*.fc18.x86_64) return 1 ;;
+ 3.1[0123].*.fc19.i686*|3.1[0123].*.fc19.x86_64) return 1 ;;
+ 3.13.*.fc20.i686*|3.13.*.fc20.x86_64) return 1 ;;
esac
}
10 years, 2 months
master - tests: add more help text and paths quotes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0fc17fe1ce0218...
Commit: 0fc17fe1ce02182e5c6f2e8abf4f22f8468e44f2
Parent: d686f3856a51490194140c694fa4364a54244630
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 14 14:10:29 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:44 2014 +0100
tests: add more help text and paths quotes
Add LVM_VALGRDIN help text
Use proper quotes for abs_ paths
(Assignment in makefile doesn't need them, only shell usage)
---
test/Makefile.in | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 9335abd..4bd90c7 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -19,10 +19,10 @@ subdir = $(shell pwd|sed 's,.*/,,')
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-abs_srcdir = "@abs_srcdir@"
-abs_builddir = "@abs_builddir@"
-abs_top_builddir = "@abs_top_builddir@"
-abs_top_srcdir = "@abs_top_srcdir@"
+abs_srcdir = @abs_srcdir@
+abs_builddir = @abs_builddir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
LVM_TEST_RESULTS ?= results
export LVM_TEST_THIN_CHECK_CMD?=@THIN_CHECK_CMD@
@@ -66,7 +66,7 @@ help:
@echo " clean Clean dir."
@echo " help Display callable targets."
@echo -e "\nSupported variables:"
- @echo " LVM_TEST_CAN_CLOBBER_DMESG Allow to clobber dmesg buffer without /dev/kmsg."
+ @echo " LVM_TEST_CAN_CLOBBER_DMESG Allow to clobber dmesg buffer without /dev/kmsg. (1)"
@echo " LVM_TEST_DEVDIR Set to '/dev' to run on real /dev."
@echo " LVM_TEST_DIR Where to create test files [$(LVM_TEST_DIR)]."
@echo " LVM_TEST_LOCKING Normal (1), Cluster (3)."
@@ -78,6 +78,10 @@ help:
@echo " LVM_TEST_THIN_DUMP_CMD Command for thin_dump [$(LVM_TEST_THIN_DUMP_CMD)]."
@echo " LVM_TEST_THIN_REPAIR_CMD Command for thin_repair [$(LVM_TEST_THIN_REPAIR_CMD)]."
@echo " LVM_TEST_UNLIMITED Set to get unlimited test log (>32MB)"
+ @echo " LVM_VALGRIND Enable valgrind testing (1,2,3) execs $$"VALGRIND
+ @echo " LVM_VALGRIND_CLVMD Enable valgrind testing of clvmd (1)."
+ @echo " LVM_VALGRIND_DMEVENTD Enable valgrind testing of dmeventd (1)."
+ @echo " LVM_VALGRIND_LVMETAD Enable valgrind testing of lvmetad (1)."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
@echo " S Skip given test (regex)."
@echo " T Run given test (regex)."
@@ -128,15 +132,15 @@ lib/%: $(srcdir)/lib/%.sh .lib-dir-stamp
lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
$(RM) $@-t
- echo 'top_srcdir=$(top_srcdir)' >> $@-t
- echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
- echo 'abs_top_srcdir=$(abs_top_srcdir)' >> $@-t
- echo 'abs_srcdir=$(abs_srcdir)' >> $@-t
- echo 'abs_builddir=$(abs_builddir)' >> $@-t
+ echo 'top_srcdir="$(top_srcdir)"' >> $@-t
+ echo 'abs_top_builddir="$(abs_top_builddir)"' >> $@-t
+ echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> $@-t
+ echo 'abs_srcdir="$(abs_srcdir)"' >> $@-t
+ echo 'abs_builddir="$(abs_builddir)"' >> $@-t
echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
echo 'export THIN=@THIN@' >> $@-t
- echo 'export LVMETAD_PIDFILE=@LVMETAD_PIDFILE@' >> $@-t
- echo 'export DMEVENTD_PIDFILE=@DMEVENTD_PIDFILE@' >> $@-t
+ echo 'export LVMETAD_PIDFILE="@LVMETAD_PIDFILE@"' >> $@-t
+ echo 'export DMEVENTD_PIDFILE="@DMEVENTD_PIDFILE@"' >> $@-t
mv $@-t $@
LIB = lib/not lib/should lib/harness \
10 years, 2 months
master - cleanup: relocate check for mirror
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d686f3856a5149...
Commit: d686f3856a51490194140c694fa4364a54244630
Parent: b738260c7cdbc6094feda9f9e2426d50bd413263
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 14:05:17 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:43 2014 +0100
cleanup: relocate check for mirror
Move testing code into _lvconvert_snapshot function.
---
tools/lvconvert.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4a26614..1331620 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2038,6 +2038,11 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
{
struct logical_volume *org;
+ if (lv->status & MIRRORED) {
+ log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
+ return 0;
+ }
+
if (lv_is_origin(lv)) {
/* Unsupported stack */
log_error("Unable to convert origin \"%s\" into a snapshot.", lv->name);
@@ -3039,10 +3044,6 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED;
}
} else if (lp->snapshot) {
- if (lv->status & MIRRORED) {
- log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
- return ECMD_FAILED;
- }
if (!_lvconvert_snapshot(cmd, lv, lp))
return_ECMD_FAILED;
10 years, 2 months
master - lvconvert: delay archiving of metadata
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b738260c7cdbc6...
Commit: b738260c7cdbc6094feda9f9e2426d50bd413263
Parent: d425e788e9ebaa2eef1fd747aec4dad03897114e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 13:07:08 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:43 2014 +0100
lvconvert: delay archiving of metadata
Delay archiving of metadata until we really start to
update metadata when converting volume into a snapshot.
Archive is not necessary when we abort operation early.
---
tools/lvconvert.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7f27dd4..4a26614 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2080,6 +2080,9 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
return 0;
}
+ if (!archive(lv->vg))
+ return_0;
+
if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) {
log_error("Couldn't create snapshot.");
return 0;
@@ -3040,9 +3043,6 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
return ECMD_FAILED;
}
- if (!archive(lv->vg))
- return_ECMD_FAILED;
-
if (!_lvconvert_snapshot(cmd, lv, lp))
return_ECMD_FAILED;
10 years, 2 months
master - lvconvert: validate min chunk size for snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d425e788e9ebaa...
Commit: d425e788e9ebaa2eef1fd747aec4dad03897114e
Parent: 3a82490ee1cf7aec5b2d6648f9bc74d9791eca8e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 13:06:00 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:43 2014 +0100
lvconvert: validate min chunk size for snapshot
Do not allow conversion of too small LV into a COW snapshot device.
Without this patch snapshot target is generating these kernel
messages before creation fails:
attempt to access beyond end of device
dm-9: rw=16, want=8, limit=2
attempt to access beyond end of device
...
device-mapper: table: 253:11: snapshot: Failed to read snapshot metadata
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on failed: Input/output error
---
WHATS_NEW | 1 +
tools/lvconvert.c | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c3c8aff..06b8033 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Validate minimal chunk size for snapshot COW volume in lvconvert.
Disallow lvconvert of origin to snapshot COW volume.
Make report settings profilable.
Add existing report settings to lvm.conf.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 1b9d9f7..7f27dd4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2055,6 +2055,9 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
return 0;
}
+ if (!cow_has_min_chunks(lv->vg, lv->le_count, lp->chunk_size))
+ return_0;
+
if (org->status & (LOCKED|PVMOVE|MIRRORED) || lv_is_cow(org)) {
log_error("Unable to convert an LV into a snapshot of a %s LV.",
org->status & LOCKED ? "locked" :
10 years, 2 months