diff options
author | David Teigland <teigland@redhat.com> | 2015-05-28 10:07:37 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-05-28 16:36:17 -0500 |
commit | 8048fc50ce9757eb708ebfa566c0a71990906f2c (patch) | |
tree | bb7e894d59d089cfc704e5c786e388339a3f4efd | |
parent | 95643166f4ef12a2b3fcebe690091f61570b07dc (diff) | |
download | lvm2-dev-dct-lvmlockd-AI.tar.gz |
test: initial structure for lvmlockd testingdev-dct-lvmlockd-AI
-rw-r--r-- | test/Makefile.in | 18 | ||||
-rw-r--r-- | test/lib/aux.sh | 124 | ||||
-rw-r--r-- | test/lib/flavour-udev-lvmlockd-dlm.sh | 6 | ||||
-rw-r--r-- | test/lib/flavour-udev-lvmlockd-sanlock.sh | 6 | ||||
-rw-r--r-- | test/lib/inittest.sh | 9 | ||||
-rw-r--r-- | test/lib/test-corosync-conf | 19 | ||||
-rw-r--r-- | test/lib/test-dlm-conf | 4 | ||||
-rw-r--r-- | test/lib/test-sanlock-conf | 2 |
8 files changed, 188 insertions, 0 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index cd2c42532..a34517e2e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -70,6 +70,8 @@ help: @echo " check_cluster Run tests with cluster daemon." @echo " check_lvmetad Run tests with lvmetad daemon." @echo " check_lvmpolld Run tests with lvmpolld daemon." + @echo " check_lvmlockd_sanlock Run tests with lvmlockd and sanlock." + @echo " check_lvmlockd_dlm Run tests with lvmlockd and dlm." @echo " clean Clean dir." @echo " help Display callable targets." @echo -e "\nSupported variables:" @@ -138,6 +140,20 @@ check_lvmpolld: .tests-stamp --flavours ndev-lvmpolld,ndev-cluster-lvmpolld,ndev-lvmetad-lvmpolld --only $(T) --skip $(S) endif +ifeq ("@BUILD_LVMLOCKD@", "yes") +check_lvmlockd_sanlock: .tests-stamp + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours udev-lvmlockd-sanlock --only $(T) --skip $(S) +endif + +ifeq ("@BUILD_LVMLOCKD@", "yes") +check_lvmlockd_dlm: .tests-stamp + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours udev-lvmlockd-dlm --only $(T) --skip $(S) +endif + DATADIR = $(datadir)/lvm2-testsuite EXECDIR = $(libexecdir)/lvm2-testsuite @@ -153,6 +169,8 @@ LIB_FLAVOURS = \ lib/flavour-udev-lvmetad-lvmpolld\ lib/flavour-udev-lvmetad\ lib/flavour-udev-lvmpolld\ + lib/flavour-udev-lvmlockd-sanlock\ + lib/flavour-udev-lvmlockd-dlm\ lib/flavour-udev-vanilla LIB_LOCAL = lib/paths lib/runner diff --git a/test/lib/aux.sh b/test/lib/aux.sh index fedf7261b..edf185129 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -176,6 +176,83 @@ lvmpolld_dump() { (echo 'request="dump"'; echo '##') | lvmpolld_talk "$@" } +prepare_lvmlockd_sanlock() { + if pgrep lvmlockd ; then + echo "Cannot run while existing lvmlockd process exists" + exit 1 + fi + + if pgrep sanlock ; then + echo "Cannot run while existing sanlock process exists" + exit 1 + fi + + lvmconf "local/host_id = 1" + create_sanlock_conf + + # FIXME: use 'systemctl start sanlock' once sysconfig options work + sanlock daemon -U sanlock -G sanlock -w 0 + sleep 1 + if ! pgrep sanlock; then + echo "Failed to start sanlock" + exit 1 + fi + + lvmlockd + sleep 1 + if ! pgrep lvmlockd; then + echo "Failed to start lvmlockd" + exit 1 + fi + +# FIXME: make this work + alias vgcreate="vgcreate --lock-type sanlock" +} + +prepare_lvmlockd_dlm() { + if pgrep lvmlockd ; then + echo "Cannot run while existing lvmlockd process exists" + exit 1 + fi + + if pgrep dlm_controld ; then + echo "Cannot run while existing dlm_controld process exists" + exit 1 + fi + + if pgrep corosync; then + echo "Cannot run while existing corosync process exists" + exit 1 + fi + + create_corosync_conf + create_dlm_conf + + systemctl start corosync + sleep 1 + if ! pgrep corosync; then + echo "Failed to start corosync" + exit 1 + fi + + systemctl start dlm + sleep 1 + if ! pgrep dlm_controld; then + echo "Failed to start dlm" + exit 1 + fi + + lvmlockd + sleep 1 + if ! pgrep lvmlockd ; then + echo "Failed to start lvmlockd" + exit 1 + fi + +# FIXME: make this work + alias vgcreate="vgcreate --lock-type dlm" +} + teardown_devs_prefixed() { local prefix=$1 local stray=${2:-0} @@ -804,6 +881,49 @@ mkdev_md5sum() { md5sum "$DM_DEV_DIR/$1/$2" > "md5.$1-$2" } +SANLOCK_CONF="/etc/sysconfig/sanlock" +create_sanlock_conf() { + if test -a $SANLOCK_CONF; then + if ! grep "created by lvm test suite" $SANLOCK_CONF; then + rm $SANLOCK_CONF + else + mv $SANLOCK_CONF $SANLOCK_CONF.prelvmtest + fi + fi + + cp lib/test-sanlock-conf $SANLOCK_CONF + echo "created new $SANLOCK_CONF" +} + +COROSYNC_CONF="/etc/corosync/corosync.conf" +COROSYNC_NODE=`hostname` +create_corosync_conf() { + if test -a $COROSYNC_CONF; then + if ! grep "created by lvm test suite" $COROSYNC_CONF; then + rm $COROSYNC_CONF + else + mv $COROSYNC_CONF $COROSYNC_CONF.prelvmtest + fi + fi + + sed -e "s/@LOCAL_NODE@/$(COROSYNC_NODE)/" lib/test-corosync-conf > $COROSYNC_CONF + echo "created new $COROSYNC_CONF" +} + +DLM_CONF="/etc/dlm/dlm.conf" +create_dlm_conf() { + if test -a $DLM_CONF; then + if ! grep "created by lvm test suite" $DLM_CONF; then + rm $DLM_CONF + else + mv $DLM_CONF $DLM_CONF.prelvmtest + fi + fi + + cp lib/test-dlm-conf $DLM_CONF + echo "created new $DLM_CONF" +} + generate_config() { if test -n "$profile_name"; then config_values=PROFILE_VALUES_$profile_name @@ -817,6 +937,9 @@ generate_config() { LVM_TEST_LOCKING=${LVM_TEST_LOCKING:-1} LVM_TEST_LVMETAD=${LVM_TEST_LVMETAD:-0} LVM_TEST_LVMPOLLD=${LVM_TEST_LVMPOLLD:-0} + LVM_TEST_LVMLOCKD=${LVM_TEST_LVMLOCKD:-0} + LVM_TEST_LOCK_TYPE_SANLOCK=${LVM_TEST_LOCK_TYPE_SANLOCK:-0} + LVM_TEST_LOCK_TYPE_DLM=${LVM_TEST_LOCK_TYPE_DLM:-0} if test "$DM_DEV_DIR" = "/dev"; then LVM_VERIFY_UDEV=${LVM_VERIFY_UDEV:-0} else @@ -859,6 +982,7 @@ global/thin_dump_executable = "$LVM_TEST_THIN_DUMP_CMD" global/thin_repair_executable = "$LVM_TEST_THIN_REPAIR_CMD" global/use_lvmetad = $LVM_TEST_LVMETAD global/use_lvmpolld = $LVM_TEST_LVMPOLLD +global/use_lvmlockd = $LVM_TEST_LVMLOCKD log/activation = 1 log/file = "$TESTDIR/debug.log" log/indent = 1 diff --git a/test/lib/flavour-udev-lvmlockd-dlm.sh b/test/lib/flavour-udev-lvmlockd-dlm.sh new file mode 100644 index 000000000..5bd274911 --- /dev/null +++ b/test/lib/flavour-udev-lvmlockd-dlm.sh @@ -0,0 +1,6 @@ +export LVM_TEST_LOCKING=1 +export LVM_TEST_LVMETAD=1 +export LVM_TEST_LVMPOLLD=1 +export LVM_TEST_LVMLOCKD=1 +export LVM_TEST_LOCK_TYPE_DLM=1 +export LVM_TEST_DEVDIR=/dev diff --git a/test/lib/flavour-udev-lvmlockd-sanlock.sh b/test/lib/flavour-udev-lvmlockd-sanlock.sh new file mode 100644 index 000000000..859ee2e66 --- /dev/null +++ b/test/lib/flavour-udev-lvmlockd-sanlock.sh @@ -0,0 +1,6 @@ +export LVM_TEST_LOCKING=1 +export LVM_TEST_LVMETAD=1 +export LVM_TEST_LVMPOLLD=1 +export LVM_TEST_LVMLOCKD=1 +export LVM_TEST_LOCK_TYPE_SANLOCK=1 +export LVM_TEST_DEVDIR=/dev diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh index 1af050338..35629fca4 100644 --- a/test/lib/inittest.sh +++ b/test/lib/inittest.sh @@ -107,6 +107,15 @@ test -n "$LVM_TEST_LVMPOLLD" && { aux prepare_lvmpolld } +if test -n "$LVM_TEST_LVMLOCKD" ; then + if test -n "$LVM_TEST_LOCK_TYPE_SANLOCK" ; then + aux prepare_lvmlockd_sanlock + fi + if test -n "$LVM_TEST_LOCK_TYPE_DLM" ; then + aux prepare_lvmlockd_dlm + fi +fi + echo "<======== Processing test: \"$TESTNAME\" ========>" set -vx diff --git a/test/lib/test-corosync-conf b/test/lib/test-corosync-conf new file mode 100644 index 000000000..ccc958f1d --- /dev/null +++ b/test/lib/test-corosync-conf @@ -0,0 +1,19 @@ +# created by lvm test suite +totem { + version: 2 + secauth: off + cluster_name: test +} +nodelist { + node { + ring0_addr: @LOCAL_NODE@ + nodeid: 1 + } +} +quorum { + provider: corosync_votequorum +} +logging { + to_syslog: yes +} + diff --git a/test/lib/test-dlm-conf b/test/lib/test-dlm-conf new file mode 100644 index 000000000..a93c93fca --- /dev/null +++ b/test/lib/test-dlm-conf @@ -0,0 +1,4 @@ +# created by lvm test suite +log_debug=1 +enable_fencing=0 + diff --git a/test/lib/test-sanlock-conf b/test/lib/test-sanlock-conf new file mode 100644 index 000000000..d1df598b0 --- /dev/null +++ b/test/lib/test-sanlock-conf @@ -0,0 +1,2 @@ +# created by lvm test suite +SANLOCKOPTS="-U sanlock -G sanlock -w 0" |