master - blkdeactivate: check for lvm binary and skip LVM processing if not present
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7a4e27eee51e89...
Commit: 7a4e27eee51e89a550bc55f78daea6d943293202
Parent: d1a770107d9525c24fc17522be450e28e1463e45
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Apr 14 13:35:11 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 14 13:35:11 2015 +0200
blkdeactivate: check for lvm binary and skip LVM processing if not present
This removes dependency on lvm binary - if it's not present, all LVM
processing is skipped (shouldn't normally happen because if lvm binary
is missing then there's obviously nothing that would activate it, but
let's make sure).
Without this tight dependency on lvm, the blkdeactivate script can
be packaged with libdevmapper/dmsetup (in contrast to lvm as it was
before) and as such the script can still be used to handle other DM
devices.
---
WHATS_NEW | 1 +
scripts/blkdeactivate.sh.in | 24 +++++++++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e496fe4..9313ffb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.119 -
==================================
+ Check for lvm binary in blkdeactivate and skip LVM processing if not present.
Add --enable-halvm and --disable-halvm options to lvmconf script.
Add --services, --mirrorservice and --startstopservices option to lvmconf.
Use proper default value of global/use_lvmetad when processing lvmconf script.
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index f454154..993f151 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2015 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -18,8 +18,10 @@
#
# Requires:
# bash >= 4.0 (associative array support)
-# lsblk >= 2.22 (lsblk -s support)
-# umount
+# util-linux {
+# lsblk >= 2.22 (lsblk -s support)
+# umount
+# }
# dmsetup >= 1.02.68 (--retry option support)
# lvm >= 2.2.89 (activation/retry_deactivation config support)
#
@@ -212,6 +214,11 @@ deactivate_lvm () {
test -z ${SKIP_VG_LIST["$DM_VG_NAME"]} || return 1
if test $LVM_DO_WHOLE_VG -eq 0; then
+ # Skip LVM device deactivation if LVM tools missing.
+ test $LVM_AVAILABLE -eq 0 && {
+ add_device_to_skip_list
+ return 1
+ }
# Deactivating only the LV specified
deactivate_holders "$DEV_DIR/$DM_VG_NAME/$DM_LV_NAME" || {
add_device_to_skip_list
@@ -227,6 +234,11 @@ deactivate_lvm () {
fi
else
+ # Skip LVM VG deactivation if LVM tools missing.
+ test $LVM_AVAILABLE -eq 0 && {
+ add_vg_to_skip_list
+ return 1
+ }
# Deactivating the whole VG the LV is part of
lv_list=$(eval $LVM vgs --config "$LVM_CONFIG" --noheadings --rows -o lv_name $DM_VG_NAME $ERR)
for lv in $lv_list; do
@@ -383,6 +395,12 @@ set_env() {
else
OUT="1>$DEV_DIR/null"
fi
+
+ if test -f $LVM; then
+ LVM_AVAILABLE=1
+ else
+ LVM_AVAILABLE=0
+ fi
}
while test $# -ne 0; do
8 years, 8 months
master - tests: update pvmove tests
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d1a770107d9525...
Commit: d1a770107d9525c24fc17522be450e28e1463e45
Parent: 75454c2b32c7f9dfd7c75a04ca2926fbf44ebb9e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 13:29:19 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 13:29:43 2015 +0200
tests: update pvmove tests
Put in pvmove background process into list quickly.
Update API for aux add_to_kill_list()/kill_listed_processes().
Run on 'background' (&) only non-background pvmoves.
---
test/lib/aux.sh | 24 ++++++++++++++----------
test/shell/pvmove-abort-all.sh | 28 ++++++++++++++++++----------
test/shell/pvmove-abort.sh | 18 ++++++++++++------
3 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 8e729a7..479c3f0 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -232,25 +232,29 @@ kill_sleep_kill_() {
# $1 cmd line
# $2 optional parms for pgrep
add_to_kill_list() {
- local p=$(pgrep $2 -f "$1" 2>/dev/null)
- test -z $p || echo $p:$1 >> kill_list
-}
-
-kill_remaining_processes() {
- local line
- while read line; do
- local pid=$(echo $line | awk -F':' '{ print $1 }')
- local cmd=$(echo $line | awk -F':' '{ print $2 }')
+ local p=$(pgrep ${@:2} -f "$1" 2>/dev/null)
+ test -z "$p" || echo "$p:$1" >> kill_list
+}
+
+kill_listed_processes() {
+ local tmp
+ local pid
+ local cmd
+ test -f kill_list || return 0
+ while read tmp; do
+ pid=${tmp%%:*}
+ cmd=${tmp##*:}
for tmp in $(pgrep -f "$cmd" -d ' '); do
- test $tmp = $pid && kill -9 $tmp
+ test "$tmp" = "$pid" && kill -9 "$tmp"
done
- done
+ done < kill_list
+ rm -f kill_list
}
teardown() {
echo -n "## teardown..."
- test -f kill_list && kill_remaining_processes < kill_list
+ kill_listed_processes
kill_sleep_kill_ LOCAL_LVMETAD ${LVM_VALGRIND_LVMETAD:-0}
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
index 0fd9659..3166965 100644
--- a/test/shell/pvmove-abort-all.sh
+++ b/test/shell/pvmove-abort-all.sh
@@ -38,17 +38,26 @@ lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
lvextend -l+30 -n $vg1/$lv1 "$dev5"
cmd1=$(echo pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode)
-$cmd1 &
-aux wait_pvmove_lv_ready "$vg-pvmove0"
cmd2=$(echo pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode)
-$cmd2 &
-aux wait_pvmove_lv_ready "$vg-pvmove1"
-
-pvmove -i1 $backgroundarg -n $vg1/$lv1 "$dev4" "$dev6" $mode &
-aux wait_pvmove_lv_ready "$vg1-pvmove0"
+cmd3=$(echo pvmove -i1 $backgroundarg -n $vg1/$lv1 "$dev4" "$dev6" $mode)
+if test -z "$backgroundarg" ; then
+ $cmd1 &
+ aux wait_pvmove_lv_ready "$vg-pvmove0"
+ $cmd2 &
+ aux wait_pvmove_lv_ready "$vg-pvmove1"
+ $cmd3 &
+ aux wait_pvmove_lv_ready "$vg1-pvmove0"
+else
+ $cmd1
+ aux add_to_kill_list "$cmd1" -P 1
+ $cmd2
+ aux add_to_kill_list "$cmd2" -P 1
+ $cmd3
+ aux add_to_kill_list "$cmd3" -P 1
+fi
# test removal of all pvmove LVs
-pvmove --abort
+pvmove --abort
# check if proper pvmove was canceled
get lv_field $vg name -a | tee out
@@ -59,8 +68,7 @@ not grep "^\[pvmove" out
lvremove -ff $vg $vg1
wait
-aux add_to_kill_list "$cmd1" "-P 1"
-aux add_to_kill_list "$cmd2" "-P 1"
+aux kill_listed_processes
done
done
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
index da98a34..39360a0 100644
--- a/test/shell/pvmove-abort.sh
+++ b/test/shell/pvmove-abort.sh
@@ -32,11 +32,18 @@ lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
cmd1=$(echo pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode)
-$cmd1 &
-aux wait_pvmove_lv_ready "$vg-pvmove0"
cmd2=$(echo pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode)
-$cmd2 &
-aux wait_pvmove_lv_ready "$vg-pvmove1"
+if test -z "$backgroundarg" ; then
+ $cmd1 &
+ aux wait_pvmove_lv_ready "$vg-pvmove0"
+ $cmd2 &
+ aux wait_pvmove_lv_ready "$vg-pvmove1"
+else
+ $cmd1
+ aux add_to_kill_list "$cmd1" -P 1
+ $cmd2
+ aux add_to_kill_list "$cmd2" -P 1
+fi
# remove specific device
pvmove --abort "$dev1"
@@ -52,8 +59,7 @@ pvmove --abort
lvremove -ff $vg
wait
-aux add_to_kill_list "$cmd1" "-P 1"
-aux add_to_kill_list "$cmd2" "-P 1"
+aux kill_listed_processes
done
done
8 years, 8 months
master - tests: rusage skipped only for skipped
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75454c2b32c7f9...
Commit: 75454c2b32c7f9dfd7c75a04ca2926fbf44ebb9e
Parent: 4cdf155a87211d269ae31c70856f580111fca186
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 11:15:42 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 13:29:43 2015 +0200
tests: rusage skipped only for skipped
---
test/lib/brick-shelltest.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h
index 00f1616..4540a71 100644
--- a/test/lib/brick-shelltest.h
+++ b/test/lib/brick-shelltest.h
@@ -917,7 +917,7 @@ struct TestCase {
if ( options.batch ) {
int spaces = std::max( 64 - int(pretty().length()), 0 );
progress( Last ) << " " << std::string( spaces, '.' ) << " " << r;
- if ( r == Journal::PASSED )
+ if ( r != Journal::SKIPPED )
progress( First ) << " " << rusage();
progress( Last ) << std::endl;
} else
8 years, 8 months
master - makefiles: check lcov file has content
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4cdf155a87211d...
Commit: 4cdf155a87211d269ae31c70856f580111fca186
Parent: a084b3122f5df4d9dcd244762132abcb5f46ea6a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 13:28:26 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 13:29:43 2015 +0200
makefiles: check lcov file has content
genhtml may get confused without content.
---
Makefile.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 41eb2e9..a7bed8e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -155,7 +155,7 @@ lcov: $(LCOV_TRACES)
$(RM) -r $(LCOV_REPORTS_DIR)
$(MKDIR_P) $(LCOV_REPORTS_DIR)
for i in $(LCOV_TRACES); do \
- test -s $$i && lc="$$lc $$i"; \
+ test -s $$i -a $$(wc -w <$$i) -ge 100 && lc="$$lc $$i"; \
done; \
test -z "$$lc" || $(GENHTML) -p @abs_top_builddir@ \
-o $(LCOV_REPORTS_DIR) $$lc
8 years, 8 months
master - tests: integrate default thin/cache tool paths
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a084b3122f5df4...
Commit: a084b3122f5df4d9dcd244762132abcb5f46ea6a
Parent: c6bcfcba8541d053f142496c30f437a694daf5ee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 10:08:57 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 10:11:36 2015 +0200
tests: integrate default thin/cache tool paths
If the system is correctly configure (cache & thin tools are present)
avoid 'extra' rebuild of configuration.
On the other hand - if some tool is missing - duplicate ##LVMCONF should
make it more straighforward to see.
---
test/lib/aux.sh | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index bccc30c..8e729a7 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -690,6 +690,12 @@ global/locking_dir = "$TESTDIR/var/lock/lvm"
global/locking_type=$LVM_TEST_LOCKING
global/si_unit_consistency = 1
global/fallback_to_local_locking = 0
+global/cache_check_executable = "$LVM_TEST_CACHE_CHECK_CMD"
+global/cache_dump_executable = "$LVM_TEST_CACHE_DUMP_CMD"
+global/cache_repair_executable = "$LVM_TEST_CACHE_REPAIR_CMD"
+global/thin_check_executable = "$LVM_TEST_THIN_CHECK_CMD"
+global/thin_dump_executable = "$LVM_TEST_THIN_DUMP_CMD"
+global/thin_repair_executable = "$LVM_TEST_THIN_REPAIR_CMD"
activation/checks = 1
activation/udev_sync = 1
activation/udev_rules = 1
@@ -887,9 +893,13 @@ have_thin() {
test -x "$LVM_TEST_THIN_CHECK_CMD" || LVM_TEST_THIN_CHECK_CMD=""
test -x "$LVM_TEST_THIN_DUMP_CMD" || LVM_TEST_THIN_DUMP_CMD=""
test -x "$LVM_TEST_THIN_REPAIR_CMD" || LVM_TEST_THIN_REPAIR_CMD=""
+ test -z "$LVM_TEST_THIN_CHECK_CMD" -o \
+ -z "$LVM_TEST_THIN_DUMP_CMD" -o \
+ -z "$LVM_TEST_THIN_REPAIR_CMD" && {
lvmconf "global/thin_check_executable = \"$LVM_TEST_THIN_CHECK_CMD\"" \
"global/thin_dump_executable = \"$LVM_TEST_THIN_DUMP_CMD\"" \
"global/thin_repair_executable = \"$LVM_TEST_THIN_REPAIR_CMD\""
+ }
}
have_raid() {
@@ -901,12 +911,17 @@ have_cache() {
test "$CACHE" = shared -o "$CACHE" = internal || return 1
target_at_least dm-cache "$@"
+ # disable cache_check if not present in system
test -x "$LVM_TEST_CACHE_CHECK_CMD" || LVM_TEST_CACHE_CHECK_CMD=""
test -x "$LVM_TEST_CACHE_DUMP_CMD" || LVM_TEST_CACHE_DUMP_CMD=""
test -x "$LVM_TEST_CACHE_REPAIR_CMD" || LVM_TEST_CACHE_REPAIR_CMD=""
+ test -z "$LVM_TEST_CACHE_CHECK_CMD" -o \
+ -z "$LVM_TEST_CACHE_DUMP_CMD" -o \
+ -z "$LVM_TEST_CACHE_REPAIR_CMD" && {
lvmconf "global/cache_check_executable = \"$LVM_TEST_CACHE_CHECK_CMD\"" \
"global/cache_dump_executable = \"$LVM_TEST_CACHE_DUMP_CMD\"" \
"global/cache_repair_executable = \"$LVM_TEST_CACHE_REPAIR_CMD\""
+ }
}
have_tool_at_least() {
8 years, 8 months
master - tests: stacktrace understands fullpath
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c6bcfcba8541d0...
Commit: c6bcfcba8541d053f142496c30f437a694daf5ee
Parent: c969e05aabb00b400d24e44c09c720f1cdebb351
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 09:48:57 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 10:11:36 2015 +0200
tests: stacktrace understands fullpath
$0 as name of script could be either relative or full path.
When it's fullpath don't prepend $TESTOLDPWD.
---
test/lib/utils.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 488e338..1713cc9 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -166,7 +166,9 @@ STACKTRACE() {
udevadm info --path "$i" || true
done | sed -e "s,^,## UDEV: ,"
echo "<======== Script file \"$(< TESTNAME)\" ========>"
- awk '{print "## Line:", NR, "\t", $0}' "$TESTOLDPWD/$0"
+ local script=$0
+ test -f "$script" || script="$TESTOLDPWD/$0"
+ awk '{print "## Line:", NR, "\t", $0}' "$script"
}
test -f SKIP_THIS_TEST && exit 200
8 years, 8 months
master - tests: avoid dup of lvm.conf
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c969e05aabb00b...
Commit: c969e05aabb00b400d24e44c09c720f1cdebb351
Parent: ee6fc17663c777f7276c56fd224fd3cecc0f77e4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 09:47:14 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 10:11:35 2015 +0200
tests: avoid dup of lvm.conf
When running lvmetad test - avoid duplicate create of lvm.conf
Also as lvmetad cannot be used with cluster make it as 2 code paths.
---
test/lib/inittest.sh | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index 067c3d4..f55938f 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -86,13 +86,15 @@ prepare_test_vars
test -n "$BASH" && set -eE -o pipefail
-aux lvmconf
-aux prepare_clvmd
-test -n "$LVM_TEST_LVMETAD" && {
+if test -n "$LVM_TEST_LVMETAD" ; then
export LVM_LVMETAD_SOCKET="$TESTDIR/lvmetad.socket"
export LVM_LVMETAD_PIDFILE="$TESTDIR/lvmetad.pid"
aux prepare_lvmetad
-}
+else
+ # lvmetad prepares its own lvmconf
+ aux lvmconf
+ aux prepare_clvmd
+fi
# Vars for harness
echo "@TESTDIR=$TESTDIR"
8 years, 8 months
master - makefiles: skip lvmetad tests
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee6fc17663c777...
Commit: ee6fc17663c777f7276c56fd224fd3cecc0f77e4
Parent: d5651f44e3056c0e0e5f0c3d05c29c575782379e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 14 09:45:36 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 14 10:11:35 2015 +0200
makefiles: skip lvmetad tests
When build without lvmetad, skip n/udev-lvmetad flavour execution.
Update help test.
---
test/Makefile.in | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 93ab24c..da09a6c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -52,6 +52,8 @@ RUN_BASE = $(subst $(srcdir)/,,$(RUN))
ifeq ("@BUILD_LVMETAD@", "yes")
LVMETAD_RUN_BASE = $(RUN_BASE)
+LVMETAD_NDEV_FLAVOUR = ,ndev-lvmetad
+LVMETAD_UDEV_FLAVOUR = ,udev-lvmetad
endif
@@ -91,10 +93,12 @@ help:
@echo " LVM_TEST_CACHE_REPAIR_CMD Command for cache_repair [$(LVM_TEST_CACHE_REPAIR_CMD)]."
@echo " LVM_TEST_CACHE_RESTORE_CMD Command for cache_restore [$(LVM_TEST_CACHE_RESTORE_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 Enable valgrind testing, 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_STRACE Enable strace logging."
+ @echo " LVM_DEBUG_LEVEL Sets debuging level for valgrind/strace (use > 0)."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
@echo " S Skip given test (regex)."
@echo " T Run given test (regex)."
@@ -103,12 +107,12 @@ help:
check: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
- --flavours ndev-vanilla,ndev-cluster,ndev-lvmetad --only $(T) --skip $(S)
+ --flavours ndev-vanilla,ndev-cluster$(LVMETAD_NDEV_FLAVOUR) --only $(T) --skip $(S)
check_system: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
- --flavours udev-vanilla,udev-cluster,udev-lvmetad --only $(T) --skip $(S)
+ --flavours udev-vanilla,udev-cluster$(LVMETAD_UDEV_FLAVOUR) --only $(T) --skip $(S)
check_cluster: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
8 years, 8 months
master - man: lvmconf: more notes on --services option
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d5651f44e3056c...
Commit: d5651f44e3056c0e0e5f0c3d05c29c575782379e
Parent: 96124c6c0b866bc4d135074a7947e1a0911dd86f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Apr 14 09:49:56 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 14 09:49:56 2015 +0200
man: lvmconf: more notes on --services option
---
man/lvmconf.8.in | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/man/lvmconf.8.in b/man/lvmconf.8.in
index de86a2d..1ce7061 100644
--- a/man/lvmconf.8.in
+++ b/man/lvmconf.8.in
@@ -20,7 +20,9 @@ lvmconf \(em LVM configuration modifier
.SH "DESCRIPTION"
lvmconf is a script that modifies the locking configuration in
-an lvm configuration file. See \fBlvm.conf\fP(5).
+an lvm configuration file. See \fBlvm.conf\fP(5). In addition
+to that, it can also set Systemd or SysV services according to
+changes in the lvm configuration if needed.
.SH "OPTIONS"
.TP
@@ -51,7 +53,8 @@ Set external \fBlocking_library\fR locking library to load if an external lockin
.TP
.BR \-\-services
In addition to setting the lvm configuration, also enable or disable related Systemd or SysV
-clvmd and lvmetad services.
+clvmd and lvmetad services. This script does not configure services provided by cluster resource
+agents.
.TP
.BR \-\-mirrorservice
Also enable or disable optional cmirrord service when handling services (applicable only with \-\-services).
8 years, 8 months
master - tests: [new] check pvmove resume works as expected
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96124c6c0b866b...
Commit: 96124c6c0b866bc4d135074a7947e1a0911dd86f
Parent: fe30658a4d5fe4e4e6bb346c9c9ee7142a98f49d
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Fri Apr 3 10:41:33 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Apr 13 20:53:18 2015 +0200
tests: [new] check pvmove resume works as expected
various methods of resuming interrupted pvmove are tested:
- pvmove
- pvmove -b
- lvchange
- vgchange
tests for commits:
- c26d81d6e6939906729d91fae83cd8bbdd743bb7
- fe30658a4d5fe4e4e6bb346c9c9ee7142a98f49d
---
test/lib/aux.sh | 20 +++
test/shell/pvmove-abort-all.sh | 8 +-
test/shell/pvmove-abort.sh | 8 +-
test/shell/pvmove-basic.sh | 4 +-
test/shell/pvmove-resume-1.sh | 227 ++++++++++++++++++++++++++++++++++
test/shell/pvmove-resume-2.sh | 186 ++++++++++++++++++++++++++++
test/shell/pvmove-resume-multiseg.sh | 210 +++++++++++++++++++++++++++++++
7 files changed, 658 insertions(+), 5 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 1b97bdc..bccc30c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -229,9 +229,29 @@ kill_sleep_kill_() {
fi
}
+# $1 cmd line
+# $2 optional parms for pgrep
+add_to_kill_list() {
+ local p=$(pgrep $2 -f "$1" 2>/dev/null)
+ test -z $p || echo $p:$1 >> kill_list
+}
+
+kill_remaining_processes() {
+ local line
+ while read line; do
+ local pid=$(echo $line | awk -F':' '{ print $1 }')
+ local cmd=$(echo $line | awk -F':' '{ print $2 }')
+ for tmp in $(pgrep -f "$cmd" -d ' '); do
+ test $tmp = $pid && kill -9 $tmp
+ done
+ done
+}
+
teardown() {
echo -n "## teardown..."
+ test -f kill_list && kill_remaining_processes < kill_list
+
kill_sleep_kill_ LOCAL_LVMETAD ${LVM_VALGRIND_LVMETAD:-0}
dm_table | not egrep -q "$vg|$vg1|$vg2|$vg3|$vg4" || {
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
index afdd3c8..0fd9659 100644
--- a/test/shell/pvmove-abort-all.sh
+++ b/test/shell/pvmove-abort-all.sh
@@ -37,9 +37,11 @@ lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
lvextend -l+30 -n $vg1/$lv1 "$dev5"
-pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+cmd1=$(echo pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode)
+$cmd1 &
aux wait_pvmove_lv_ready "$vg-pvmove0"
-pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+cmd2=$(echo pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode)
+$cmd2 &
aux wait_pvmove_lv_ready "$vg-pvmove1"
pvmove -i1 $backgroundarg -n $vg1/$lv1 "$dev4" "$dev6" $mode &
@@ -57,6 +59,8 @@ not grep "^\[pvmove" out
lvremove -ff $vg $vg1
wait
+aux add_to_kill_list "$cmd1" "-P 1"
+aux add_to_kill_list "$cmd2" "-P 1"
done
done
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
index 3664deb..da98a34 100644
--- a/test/shell/pvmove-abort.sh
+++ b/test/shell/pvmove-abort.sh
@@ -31,9 +31,11 @@ do
lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
-pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+cmd1=$(echo pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode)
+$cmd1 &
aux wait_pvmove_lv_ready "$vg-pvmove0"
-pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+cmd2=$(echo pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode)
+$cmd2 &
aux wait_pvmove_lv_ready "$vg-pvmove1"
# remove specific device
@@ -50,6 +52,8 @@ pvmove --abort
lvremove -ff $vg
wait
+aux add_to_kill_list "$cmd1" "-P 1"
+aux add_to_kill_list "$cmd2" "-P 1"
done
done
diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh
index 1b9b63f..e93a04e 100644
--- a/test/shell/pvmove-basic.sh
+++ b/test/shell/pvmove-basic.sh
@@ -334,7 +334,9 @@ check_and_cleanup_lvs_
#COMM "pvmove abort"
restore_lvs_
-pvmove $mode -i100 -b "$dev1" "$dev3"
+cmd=$(echo -n pvmove $mode -i100 -b "$dev1" "$dev3")
+$cmd
+aux add_to_kill_list "$cmd" "-P 1"
pvmove --abort
check_and_cleanup_lvs_
diff --git a/test/shell/pvmove-resume-1.sh b/test/shell/pvmove-resume-1.sh
new file mode 100644
index 0000000..0731c48
--- /dev/null
+++ b/test/shell/pvmove-resume-1.sh
@@ -0,0 +1,227 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+
+# Check whether all available pvmove resume methods works as expected.
+# lvchange is able to resume pvmoves in progress.
+
+# 2 pvmove LVs in 2 VGs (1 per VG)
+
+. lib/inittest
+
+aux prepare_pvs 4 30
+
+vgcreate -s 128k $vg "$dev1"
+vgcreate -s 128k $vg1 "$dev2"
+pvcreate --metadatacopies 0 "$dev3"
+pvcreate --metadatacopies 0 "$dev4"
+vgextend $vg "$dev3"
+vgextend $vg1 "$dev4"
+
+# $1 resume fn
+test_pvmove_resume() {
+ lvcreate -an -Zn -l30 -n $lv1 $vg
+ lvcreate -an -Zn -l30 -n $lv1 $vg1
+
+ aux delay_dev "$dev3" 0 1000 $(get first_extent_sector "$dev3"):
+ aux delay_dev "$dev4" 0 1000 $(get first_extent_sector "$dev4"):
+
+ pvmove -i5 "$dev1" &
+ PVMOVE=$!
+ aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+ kill -9 $PVMOVE
+
+ pvmove -i5 "$dev2" &
+ PVMOVE=$!
+ aux wait_pvmove_lv_ready "$vg1-pvmove0" 300
+ kill -9 $PVMOVE
+
+ if test -e LOCAL_LVMPOLLD ; then
+ # inforestart lvmpolld
+ kill $(< LOCAL_LVMPOLLD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
+ test -e "$LVM_LVMPOLLD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_lvmpolld
+ fi
+
+ wait
+
+ while dmsetup status "$vg-$lv1"; do dmsetup remove "$vg-$lv1" || true; done
+ while dmsetup status "$vg1-$lv1"; do dmsetup remove "$vg1-$lv1" || true; done
+ while dmsetup status "$vg-pvmove0"; do dmsetup remove "$vg-pvmove0" || true; done
+ while dmsetup status "$vg1-pvmove0"; do dmsetup remove "$vg1-pvmove0" || true; done
+
+ check lv_attr_bit type $vg/pvmove0 "p"
+ check lv_attr_bit type $vg1/pvmove0 "p"
+
+ if test -e LOCAL_CLVMD ; then
+ # giveup all clvmd locks (faster then restarting clvmd)
+ # no deactivation happen, nodes are already removed
+ #vgchange -an $vg
+ # FIXME: However above solution has one big problem
+ # as clvmd starts to abort on internal errors on various
+ # errors, based on the fact pvmove is killed -9
+ # Restart clvmd
+ kill $(< LOCAL_CLVMD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of clvmd is too slow."
+ test -e "$CLVMD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_clvmd
+ fi
+
+ if test -e LOCAL_LVMETAD ; then
+ # Restart lvmetad
+ kill $(< LOCAL_LVMETAD)
+ aux prepare_lvmetad
+ fi
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # call resume function (see below)
+ # with expected number of spawned
+ # bg polling as parameter
+ $1 2
+
+ aux enable_dev "$dev3"
+ aux enable_dev "$dev4"
+
+ i=0
+ while get lv_field $vg name -a | grep "^\[pvmove"; do
+ # wait for 30 secs at max
+ test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ sleep .1
+ i=$((i + 1))
+ done
+ while get lv_field $vg1 name -a | grep "^\[pvmove"; do
+ # wait for 30 secs at max
+ test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ sleep .1
+ i=$((i + 1))
+ done
+
+ lvremove -ff $vg $vg1
+}
+
+lvchange_single() {
+ lvchange -aey $vg/$lv1
+ lvchange -aey $vg1/$lv1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+lvchange_all() {
+ lvchange -aey $vg/$lv1 $vg1/$lv1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+vgchange_single() {
+ vgchange -aey $vg
+ vgchange -aey $vg1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+vgchange_all() {
+ vgchange -aey $vg $vg1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+pvmove_fg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg $vg1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg1 name -a | grep "^\[pvmove0\]"
+
+ # disable delay device
+ # fg pvmove would take ages to complete otherwise
+ aux enable_dev "$dev3"
+ aux enable_dev "$dev4"
+
+ pvmove -i0
+}
+
+pvmove_bg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg $vg1
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg1 name -a | grep "^\[pvmove0\]"
+
+ pvmove -b -i0
+}
+
+pvmove_fg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg1 name -a | grep "^\[pvmove0\]"
+
+ # disable delay device
+ # fg pvmove would take ages to complete otherwise
+ aux enable_dev "$dev3"
+ aux enable_dev "$dev4"
+
+ pvmove -i0 "$dev1"
+ pvmove -i0 "$dev2"
+}
+
+pvmove_bg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg1 name -a | grep "^\[pvmove0\]"
+
+ pvmove -i0 -b "$dev1"
+ pvmove -i0 -b "$dev2"
+}
+
+test -e LOCAL_CLVMD && skip
+
+test_pvmove_resume lvchange_single
+test_pvmove_resume lvchange_all
+test_pvmove_resume vgchange_single
+test_pvmove_resume vgchange_all
+test_pvmove_resume pvmove_fg
+test_pvmove_resume pvmove_fg_single
+test_pvmove_resume pvmove_bg
+test_pvmove_resume pvmove_bg_single
+
+vgremove -ff $vg $vg1
diff --git a/test/shell/pvmove-resume-2.sh b/test/shell/pvmove-resume-2.sh
new file mode 100644
index 0000000..0b938f8
--- /dev/null
+++ b/test/shell/pvmove-resume-2.sh
@@ -0,0 +1,186 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+
+# Check whether all available pvmove resume methods works as expected.
+# lvchange is able to resume pvmoves in progress.
+
+# Moving 2 LVs in VG variant
+
+. lib/inittest
+
+aux prepare_pvs 9 30
+
+vgcreate -s 128k $vg "$dev1"
+pvcreate --metadatacopies 0 "$dev2"
+vgextend $vg "$dev2"
+
+test_pvmove_resume() {
+ # 2 LVs on same device
+ lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1"
+ lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1"
+
+ aux delay_dev "$dev2" 0 1000 $(get first_extent_sector "$dev2"):
+
+ pvmove -i5 "$dev1" &
+ PVMOVE=$!
+ aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+ kill -9 $PVMOVE
+
+ if test -e LOCAL_LVMPOLLD ; then
+ # inforestart lvmpolld
+ kill $(< LOCAL_LVMPOLLD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
+ test -e "$LVM_LVMPOLLD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_lvmpolld
+ fi
+
+ wait
+
+ while dmsetup status "$vg-$lv1"; do dmsetup remove "$vg-$lv1" || true; done
+ while dmsetup status "$vg-$lv2"; do dmsetup remove "$vg-$lv2" || true; done
+ while dmsetup status "$vg-pvmove0"; do dmsetup remove "$vg-pvmove0" || true; done
+
+ check lv_attr_bit type $vg/pvmove0 "p"
+
+ if test -e LOCAL_CLVMD ; then
+ # giveup all clvmd locks (faster then restarting clvmd)
+ # no deactivation happen, nodes are already removed
+ #vgchange -an $vg
+ # FIXME: However above solution has one big problem
+ # as clvmd starts to abort on internal errors on various
+ # errors, based on the fact pvmove is killed -9
+ # Restart clvmd
+ kill $(< LOCAL_CLVMD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of clvmd is too slow."
+ test -e "$CLVMD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_clvmd
+ fi
+
+ if test -e LOCAL_LVMETAD ; then
+ # Restart lvmetad
+ kill $(< LOCAL_LVMETAD)
+ aux prepare_lvmetad
+ fi
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # call resume function (see below)
+ # with expected number of spawned
+ # bg polling as parameter
+ $1 1
+
+ aux enable_dev "$dev2"
+
+ i=0
+ while get lv_field $vg name -a | grep "^\[pvmove"; do
+ # wait for 30 secs at max
+ test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ sleep .1
+ i=$((i + 1))
+ done
+
+ lvremove -ff $vg
+}
+
+lvchange_single() {
+ lvchange -aey $vg/$lv1
+ lvchange -aey $vg/$lv2
+}
+
+lvchange_all() {
+ lvchange -aey $vg/$lv1 $vg/$lv2
+
+ # we don't want to spawn more than $1 background pollings
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1 || should false
+}
+
+vgchange_single() {
+ vgchange -aey $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+pvmove_fg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+
+ aux enable_dev "$dev2"
+
+ pvmove -i0
+}
+
+pvmove_bg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+
+ pvmove -b -i0
+}
+
+pvmove_fg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+
+ aux enable_dev "$dev2"
+
+ pvmove -i0 "$dev1"
+}
+
+pvmove_bg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+
+ pvmove -i0 -b "$dev1"
+}
+
+test -e LOCAL_CLVMD && skip
+
+test_pvmove_resume lvchange_single
+test_pvmove_resume lvchange_all
+test_pvmove_resume vgchange_single
+test_pvmove_resume pvmove_fg
+test_pvmove_resume pvmove_fg_single
+test_pvmove_resume pvmove_bg
+test_pvmove_resume pvmove_bg_single
+
+vgremove -ff $vg
diff --git a/test/shell/pvmove-resume-multiseg.sh b/test/shell/pvmove-resume-multiseg.sh
new file mode 100644
index 0000000..829178c
--- /dev/null
+++ b/test/shell/pvmove-resume-multiseg.sh
@@ -0,0 +1,210 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+
+# Check whether all available pvmove resume methods works as expected.
+# lvchange is able to resume pvmoves in progress.
+
+# Multisegment variant w/ 2 pvmoves LVs per VG
+
+. lib/inittest
+
+aux prepare_pvs 5 30
+
+vgcreate -s 128k $vg "$dev1" "$dev2" "$dev3"
+pvcreate --metadatacopies 0 "$dev4" "$dev5"
+vgextend $vg "$dev4" "$dev5"
+
+# $1 resume fn
+test_pvmove_resume() {
+ # Create multisegment LV
+ lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
+ lvextend -l+30 $vg/$lv1 "$dev2"
+ # next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG)
+ lvcreate -an -Zn -l30 -n $lv2 $vg "$dev3"
+
+ aux delay_dev "$dev4" 0 250
+ aux delay_dev "$dev5" 0 250
+
+ pvmove -i5 "$dev1" "$dev4" &
+ PVMOVE=$!
+ aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+ kill -9 $PVMOVE
+
+ pvmove -i5 -n $vg/$lv2 "$dev3" "$dev5" &
+ PVMOVE=$!
+ aux wait_pvmove_lv_ready "$vg-pvmove1" 300
+ kill -9 $PVMOVE
+
+ if test -e LOCAL_LVMPOLLD ; then
+ # inforestart lvmpolld
+ kill $(< LOCAL_LVMPOLLD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of lvmpolld is too slow."
+ test -e "$LVM_LVMPOLLD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_lvmpolld
+ fi
+
+ wait
+
+ while dmsetup status "$vg-$lv1"; do dmsetup remove "$vg-$lv1" || true; done
+ while dmsetup status "$vg-$lv2"; do dmsetup remove "$vg-$lv2" || true; done
+ while dmsetup status "$vg-pvmove0"; do dmsetup remove "$vg-pvmove0" || true; done
+ while dmsetup status "$vg-pvmove1"; do dmsetup remove "$vg-pvmove1" || true; done
+
+ check lv_attr_bit type $vg/pvmove0 "p"
+ check lv_attr_bit type $vg/pvmove1 "p"
+
+ if test -e LOCAL_CLVMD ; then
+ # giveup all clvmd locks (faster then restarting clvmd)
+ # no deactivation happen, nodes are already removed
+ #vgchange -an $vg
+ # FIXME: However above solution has one big problem
+ # as clvmd starts to abort on internal errors on various
+ # errors, based on the fact pvmove is killed -9
+ # Restart clvmd
+ kill $(< LOCAL_CLVMD)
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Shutdown of clvmd is too slow."
+ test -e "$CLVMD_PIDFILE" || break
+ sleep .1
+ done # wait for the pid removal
+ aux prepare_clvmd
+ fi
+
+ if test -e LOCAL_LVMETAD ; then
+ # Restart lvmetad
+ kill $(< LOCAL_LVMETAD)
+ aux prepare_lvmetad
+ fi
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # call resume function (see below)
+ # with expected number of spawned
+ # bg polling as parameter
+ $1 2
+
+ aux enable_dev "$dev4"
+ aux enable_dev "$dev5"
+
+ i=0
+ while get lv_field $vg name -a | grep "^\[pvmove"; do
+ # wait for 30 secs at max
+ test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ sleep .1
+ i=$((i + 1))
+ done
+
+ lvremove -ff $vg
+}
+
+lvchange_single() {
+ lvchange -aey $vg/$lv1
+ lvchange -aey $vg/$lv2
+}
+
+lvchange_all() {
+ lvchange -aey $vg/$lv1 $vg/$lv2
+
+ # we don't want to spawn more than $1 background pollings
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1 || should false
+}
+
+vgchange_single() {
+ vgchange -aey -vvvv $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq $1
+}
+
+pvmove_fg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg name -a | grep "^\[pvmove1\]"
+
+ # disable delay device
+ # fg pvmove would take ages to complete otherwise
+ aux enable_dev "$dev4"
+ aux enable_dev "$dev5"
+
+ pvmove -i0
+}
+
+pvmove_bg() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg name -a | grep "^\[pvmove1\]"
+
+ pvmove -b -i0
+}
+
+pvmove_fg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg name -a | grep "^\[pvmove1\]"
+
+ # disable delay device
+ # fg pvmove would take ages to complete otherwise
+ aux enable_dev "$dev4"
+ aux enable_dev "$dev5"
+
+ pvmove -i0 "$dev1"
+ pvmove -i0 "$dev3"
+}
+
+pvmove_bg_single() {
+ # pvmove resume requires LVs active
+ vgchange -aey --poll n $vg
+
+ ps h -C lvm | tee out || true
+ test $(wc -l < out) -eq 0
+
+ # vgchange must not spawn (thus finish) background polling
+ get lv_field $vg name -a | grep "^\[pvmove0\]"
+ get lv_field $vg name -a | grep "^\[pvmove1\]"
+
+ pvmove -i0 -b "$dev1"
+ pvmove -i0 -b "$dev3"
+}
+
+test -e LOCAL_CLVMD && skip
+
+test_pvmove_resume lvchange_single
+test_pvmove_resume lvchange_all
+test_pvmove_resume vgchange_single
+test_pvmove_resume pvmove_fg
+test_pvmove_resume pvmove_fg_single
+test_pvmove_resume pvmove_bg
+test_pvmove_resume pvmove_bg_single
+
+vgremove -ff $vg
8 years, 8 months