main - tests: writecache-blocksize add dm-cache tests
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a7f334a53269ee69674...
Commit: a7f334a53269ee6967417a01d37b7f9592637cfc
Parent: c43f2f8ae08ed0555a300764c8644ea56f4f41e2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jun 7 12:11:12 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jun 7 12:11:12 2021 -0500
tests: writecache-blocksize add dm-cache tests
Add the same tests for dm-cache as exist for dm-writecache,
dm-cache uses a different blocksize in a couple cases.
---
test/shell/writecache-blocksize.sh | 64 +++++++++++++++++++++++++++-----------
1 file changed, 45 insertions(+), 19 deletions(-)
diff --git a/test/shell/writecache-blocksize.sh b/test/shell/writecache-blocksize.sh
index a8bb1e49d..2579ef7b7 100644
--- a/test/shell/writecache-blocksize.sh
+++ b/test/shell/writecache-blocksize.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# Test writecache usage
+# Test dm-writecache and dm-cache with different block size combinations
SKIP_WITH_LVMPOLLD=1
@@ -94,6 +94,7 @@ _verify_data_on_lv() {
lvchange -an $vg/$lv1
}
+# Check that the LBS/PBS that were set up is accurately reported for the devs.
_check_env() {
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size "$1"
@@ -105,24 +106,33 @@ _check_env() {
blockdev --getpbsz "$dev2"
}
+#
+# _run_test $BS1 $BS2 $type $optname "..."
+#
+# $BS1: the xfs sectsz is verified to match $BS1, after mkfs
+# $BS2: the lv1 LBS is verified to match $BS2, after cache is added to lv1
+# $type is cache or writecache to use in lvconvert --type $type
+# $optname is either --cachevol or --cachepool to use in lvconvert
+# "..." a sector size option to use in mkfs.xfs
+#
+
_run_test() {
vgcreate $SHARED $vg "$dev1"
vgextend $vg "$dev2"
lvcreate -n $lv1 -l 8 -an $vg "$dev1"
lvcreate -n $lv2 -l 4 -an $vg "$dev2"
lvchange -ay $vg/$lv1
- mkfs.xfs -f $2 "$DM_DEV_DIR/$vg/$lv1" |tee out
+ mkfs.xfs -f $5 "$DM_DEV_DIR/$vg/$lv1" |tee out
grep "sectsz=$1" out
_add_new_data_to_mnt
- lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
+ lvconvert --yes --type $3 $4 $lv2 $vg/$lv1
blockdev --getss "$DM_DEV_DIR/$vg/$lv1" |tee out
- grep "$1" out
+ grep "$2" out
blockdev --getpbsz "$DM_DEV_DIR/$vg/$lv1"
_add_more_data_to_mnt
_verify_data_on_mnt
lvconvert --splitcache $vg/$lv1
check lv_field $vg/$lv1 segtype linear
- check lv_field $vg/$lv2 segtype linear
blockdev --getss "$DM_DEV_DIR/$vg/$lv1"
blockdev --getpbsz "$DM_DEV_DIR/$vg/$lv1"
_verify_data_on_mnt
@@ -136,7 +146,7 @@ _run_test() {
vgremove $vg
}
-# scsi_debug devices with 512 LBS 512 PBS
+# Setup: LBS 512, PBS 512
aux prepare_scsi_debug_dev 256 || skip
aux prepare_devs 2 64
@@ -150,43 +160,58 @@ vgremove -ff $vg
_check_env "512" "512"
-# lbs 512, pbs 512, xfs 512, wc 512
-_run_test 512 ""
+# lbs 512, pbs 512, xfs 512, wc bs 512
+_run_test 512 512 "writecache" "--cachevol" ""
+# lbs 512, pbs 512, xfs 512, cache bs 512
+_run_test 512 512 "cache" "--cachevol" ""
+_run_test 512 512 "cache" "--cachepool" ""
-# lbs 512, pbs 512, xfs -s 4096, wc 4096
-_run_test 4096 "-s size=4096"
+# lbs 512, pbs 512, xfs -s 4096, wc bs 4096
+_run_test 4096 4096 "writecache" "--cachevol" "-s size=4096"
+# lbs 512, pbs 512, xfs -s 4096, cache bs 512
+_run_test 4096 512 "cache" "--cachevol" "-s size=4096"
+_run_test 4096 512 "cache" "--cachepool" "-s size=4096"
aux cleanup_scsi_debug_dev
-# lbs=512, pbs=4096
+# Setup: LBS 512, PBS 4096
aux prepare_scsi_debug_dev 256 sector_size=512 physblk_exp=3
aux prepare_devs 2 64
_check_env "512" "4096"
-# lbs 512, pbs 4k, xfs 4k, wc 4k
-_run_test 4096 ""
+# lbs 512, pbs 4k, xfs 4k, wc bs 4k
+_run_test 4096 4096 "writecache" "--cachevol" ""
+# lbs 512, pbs 4k, xfs 4k, cache bs 512
+_run_test 4096 512 "cache" "--cachevol" ""
+_run_test 4096 512 "cache" "--cachepool" ""
-# lbs 512, pbs 4k, xfs -s 512, wc 512
-_run_test 512 "-s size=512"
+# lbs 512, pbs 4k, xfs -s 512, wc bs 512
+_run_test 512 512 "writecache" "--cachevol" "-s size=512"
+# lbs 512, pbs 4k, xfs -s 512, cache bs 512
+_run_test 512 512 "cache" "--cachevol" "-s size=512"
+_run_test 512 512 "cache" "--cachepool" "-s size=512"
aux cleanup_scsi_debug_dev
-# scsi_debug devices with 4K LBS and 4K PBS
+# Setup: LBS 4096, PBS 4096
aux prepare_scsi_debug_dev 256 sector_size=4096
aux prepare_devs 2 64
_check_env "4096" "4096"
-# lbs 4k, pbs 4k, xfs 4k, wc 4k
-_run_test 4096 ""
+# lbs 4k, pbs 4k, xfs 4k, wc bs 4k
+_run_test 4096 4096 "writecache" "--cachevol" ""
+# lbs 4k, pbs 4k, xfs 4k, cache bs 4k
+_run_test 4096 4096 "cache" "--cachevol" ""
+_run_test 4096 4096 "cache" "--cachepool" ""
aux cleanup_scsi_debug_dev
-# scsi_debug devices with 512 LBS 512 PBS
+# Setup: LBS 512, PBS 512
aux prepare_scsi_debug_dev 256 || skip
aux prepare_devs 2 64
@@ -222,3 +247,4 @@ lvremove $vg/$lv2
vgremove $vg
aux cleanup_scsi_debug_dev
+
2 years, 10 months
main - fix empty mem pool leak
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c43f2f8ae08ed0555a3...
Commit: c43f2f8ae08ed0555a300764c8644ea56f4f41e2
Parent: fe05828e7e4c78a1ed4430ce4057c785d0b898a0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jun 3 14:44:55 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 14:46:33 2021 -0500
fix empty mem pool leak
of "config" when LVM_SYSTEM_DIR=""
---
lib/commands/toolcontext.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 296618686..e2be89d0f 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -966,8 +966,8 @@ static void _destroy_config(struct cmd_context *cmd)
/* CONFIG_FILE/CONFIG_MERGED_FILES */
if ((cft = remove_config_tree_by_source(cmd, CONFIG_MERGED_FILES)))
config_destroy(cft);
- else
- remove_config_tree_by_source(cmd, CONFIG_FILE);
+ else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE)))
+ config_destroy(cft);
dm_list_iterate_items(cfl, &cmd->config_files)
config_destroy(cfl->cft);
2 years, 10 months
main - tests: multi-hosts: Test lease timeout with LV shareable mode
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fe05828e7e4c78a1ed4...
Commit: fe05828e7e4c78a1ed4430ce4057c785d0b898a0
Parent: 0a4d6d9d1d8ef4e3fe141c757dd5aad4b48b316c
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:25 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: multi-hosts: Test lease timeout with LV shareable mode
This patch is to test timeout handling after activate LV with shareable
mode. It has the same logic with the testing for LV exclusive mode,
except it verifies the locking with shareable mode.
On the host A:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hosta.sh
On the host B:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hostb.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/multi_hosts_lv_sh_timeout_hosta.sh | 87 +++++++++++++++++++++++++++
test/shell/multi_hosts_lv_sh_timeout_hostb.sh | 56 +++++++++++++++++
2 files changed, 143 insertions(+)
diff --git a/test/shell/multi_hosts_lv_sh_timeout_hosta.sh b/test/shell/multi_hosts_lv_sh_timeout_hosta.sh
new file mode 100644
index 000000000..6b24f9290
--- /dev/null
+++ b/test/shell/multi_hosts_lv_sh_timeout_hosta.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2021 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing.
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+for d in "${BLKDEVS[@]}"; do
+ dd if=/dev/zero of="$d" bs=32k count=1
+ wipefs -a "$d" 2>/dev/null || true
+
+ sg_dev=`sg_map26 ${d}`
+ if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
+ echo "Cleanup IDM context for drive ${d} ($sg_dev)"
+ sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ 88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
+ sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ 8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
+ rm /tmp/idm_tmp_data.bin
+ fi
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ vgcreate $SHARED TESTVG$i ${BLKDEVS[$(( i - 1 ))]}
+ lvcreate -a n --zero n -l 1 -n foo TESTVG$i
+ lvchange -a sy TESTVG$i/foo
+done
+
+for d in "${BLKDEVS[@]}"; do
+ drive_wwn=`udevadm info $d | awk -F= '/E: ID_WWN=/ {print $2}'`
+ for dev in /dev/*; do
+ if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
+ wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ if [ "$wwn" = "$drive_wwn" ]; then
+ base_name="$(basename -- ${dev})"
+ drive_list+=("$base_name")
+ host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ fi
+ fi
+ done
+done
+
+for d in "${drive_list[@]}"; do
+ [ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete
+done
+
+sleep 100
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ check grep_lvmlockd_dump "S lvm_TESTVG$i kill_vg"
+ lvmlockctl --drop TESTVG$i
+done
+
+# Rescan drives so can probe the deleted drives and join back them
+for h in "${host_list[@]}"; do
+ [ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan
+done
diff --git a/test/shell/multi_hosts_lv_sh_timeout_hostb.sh b/test/shell/multi_hosts_lv_sh_timeout_hostb.sh
new file mode 100644
index 000000000..7aea2235d
--- /dev/null
+++ b/test/shell/multi_hosts_lv_sh_timeout_hostb.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2021 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing.
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgchange --lock-start
+
+vgdisplay
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ lvchange -a sy TESTVG$i/foo
+done
+
+# Sleep for 70 seconds so the previous lease is expired
+sleep 70
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ lvchange -a ey TESTVG$i/foo
+ lvchange -a n TESTVG$i/foo
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ vgremove -f TESTVG$i
+done
2 years, 10 months
main - tests: multi-hosts: Test lease timeout with LV exclusive mode
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0a4d6d9d1d8ef4e3fe1...
Commit: 0a4d6d9d1d8ef4e3fe141c757dd5aad4b48b316c
Parent: e9950efff1d8cad43d6aec38fa30ff8b801960fb
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:24 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: multi-hosts: Test lease timeout with LV exclusive mode
This patch is to test timeout handling after activate LV with exclusive
mode. It contains two scripts for host A and host B separately.
The script on host A firstly creates VGs and LVs based on the passed
back devices, every back device is for a dedicated VG and a LV is
created as well in the VG. Afterwards, all LVs are activated by host A,
so host A acquires the lease for these LVs. Then the test is designed
to fail on host A.
After the host A fails, host B starts to run the paired testing script,
it firstly fails to activate the LVs since the locks are leased by
host A; after lease expiration (after 70s), host B can achieve the lease
for LVs and it can operate LVs and VGs.
On the host A:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hosta.sh
On the host B:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hostb.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/multi_hosts_lv_ex_timeout_hosta.sh | 87 +++++++++++++++++++++++++++
test/shell/multi_hosts_lv_ex_timeout_hostb.sh | 56 +++++++++++++++++
2 files changed, 143 insertions(+)
diff --git a/test/shell/multi_hosts_lv_ex_timeout_hosta.sh b/test/shell/multi_hosts_lv_ex_timeout_hosta.sh
new file mode 100644
index 000000000..c8be91ee3
--- /dev/null
+++ b/test/shell/multi_hosts_lv_ex_timeout_hosta.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2021 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing.
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+for d in "${BLKDEVS[@]}"; do
+ dd if=/dev/zero of="$d" bs=32k count=1
+ wipefs -a "$d" 2>/dev/null || true
+
+ sg_dev=`sg_map26 ${d}`
+ if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
+ echo "Cleanup IDM context for drive ${d} ($sg_dev)"
+ sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ 88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
+ sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ 8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
+ rm /tmp/idm_tmp_data.bin
+ fi
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ vgcreate $SHARED TESTVG$i ${BLKDEVS[$(( i - 1 ))]}
+ lvcreate -a n --zero n -l 1 -n foo TESTVG$i
+ lvchange -a ey TESTVG$i/foo
+done
+
+for d in "${BLKDEVS[@]}"; do
+ drive_wwn=`udevadm info $d | awk -F= '/E: ID_WWN=/ {print $2}'`
+ for dev in /dev/*; do
+ if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
+ wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ if [ "$wwn" = "$drive_wwn" ]; then
+ base_name="$(basename -- ${dev})"
+ drive_list+=("$base_name")
+ host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ fi
+ fi
+ done
+done
+
+for d in "${drive_list[@]}"; do
+ [ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete
+done
+
+sleep 100
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ check grep_lvmlockd_dump "S lvm_TESTVG$i kill_vg"
+ lvmlockctl --drop TESTVG$i
+done
+
+# Rescan drives so can probe the deleted drives and join back them
+for h in "${host_list[@]}"; do
+ [ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan
+done
diff --git a/test/shell/multi_hosts_lv_ex_timeout_hostb.sh b/test/shell/multi_hosts_lv_ex_timeout_hostb.sh
new file mode 100644
index 000000000..f0273fa44
--- /dev/null
+++ b/test/shell/multi_hosts_lv_ex_timeout_hostb.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2021 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing.
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgchange --lock-start
+
+vgdisplay
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ not lvchange -a ey TESTVG$i/foo
+done
+
+# Sleep for 70 seconds so the previous lease is expired
+sleep 70
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ lvchange -a ey TESTVG$i/foo
+ lvchange -a n TESTVG$i/foo
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ vgremove -f TESTVG$i
+done
2 years, 10 months
main - tests: multi-hosts: Add LV testing
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e9950efff1d8cad43d6...
Commit: e9950efff1d8cad43d6aec38fa30ff8b801960fb
Parent: e75bd71aaea6e092b93533bdc948fd527821d297
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:23 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: multi-hosts: Add LV testing
This patch is to add LV testing on multi hosts. There have two scripts,
the script multi_hosts_lv_hosta.sh is used to create LVs on one host,
and the second script multi_hosts_lv_hostb.sh will acquire
global lock and VG lock, and remove VGs. The testing flow verifies the
locking operations between two hosts with lvmlockd and the backend
locking manager.
On the host A:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hosta.sh
On the host B:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hostb.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/multi_hosts_lv_hosta.sh | 78 ++++++++++++++++++++++++++++++++++++++
test/shell/multi_hosts_lv_hostb.sh | 61 +++++++++++++++++++++++++++++
2 files changed, 139 insertions(+)
diff --git a/test/shell/multi_hosts_lv_hosta.sh b/test/shell/multi_hosts_lv_hosta.sh
new file mode 100644
index 000000000..68404d251
--- /dev/null
+++ b/test/shell/multi_hosts_lv_hosta.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing, the paired scripts
+# are: multi_hosts_lv_hosta.sh / multi_hosts_lv_hostb.sh
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+BLKDEVS_NUM=${#BLKDEVS[@]}
+
+for d in "${BLKDEVS[@]}"; do
+ dd if=/dev/zero of="$d" bs=32k count=1
+ wipefs -a "$d" 2>/dev/null || true
+
+ sg_dev=`sg_map26 ${d}`
+ if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
+ echo "Cleanup IDM context for drive ${d} ($sg_dev)"
+ sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ 88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
+ sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ 8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
+ rm /tmp/idm_tmp_data.bin
+ fi
+done
+
+#aux prepare_pvs $BLKDEVS_NUM 6400
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ echo $i
+ d="dev$i"
+ vgcreate $SHARED TESTVG$i ${BLKDEVS[$(( i - 1 ))]}
+
+ for j in {1..20}; do
+ lvcreate -a n --zero n -l 1 -n foo$j TESTVG$i
+ done
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ for j in {1..20}; do
+ lvchange -a ey TESTVG$i/foo$j
+ done
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ for j in {1..20}; do
+ lvchange -a n TESTVG$i/foo$j
+ done
+done
diff --git a/test/shell/multi_hosts_lv_hostb.sh b/test/shell/multi_hosts_lv_hostb.sh
new file mode 100644
index 000000000..13efd1a6b
--- /dev/null
+++ b/test/shell/multi_hosts_lv_hostb.sh
@@ -0,0 +1,61 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing, the paired scripts
+# are: multi_hosts_lv_hosta.sh / multi_hosts_lv_hostb.sh
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgchange --lock-start
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ for j in {1..20}; do
+ lvchange -a sy TESTVG$i/foo$j
+ done
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ for j in {1..20}; do
+ lvchange -a ey TESTVG$i/foo$j
+ done
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ for j in {1..20}; do
+ lvchange -a n TESTVG$i/foo$j
+ done
+done
+
+for i in $(seq 1 ${#BLKDEVS[@]}); do
+ vgremove -f TESTVG$i
+done
2 years, 10 months
main - tests: multi-hosts: Add VG testing
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e75bd71aaea6e092b93...
Commit: e75bd71aaea6e092b93533bdc948fd527821d297
Parent: 92b47d8eb8c4b717fd79d0b7c50ecac0dceb31a5
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:22 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: multi-hosts: Add VG testing
This patch is to add VG testing on multi hosts. There have two scripts,
the script multi_hosts_vg_hosta.sh is used to create VGs on one host,
and the second script multi_hosts_vg_hostb.sh afterwards will acquire
global lock and VG lock, and remove VGs. The testing flow verifies the
locking operations between two hosts with lvmlockd and the backend
locking manager.
On the host A:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hosta.sh
On the host B:
make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hostb.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/Makefile.in | 1 +
test/lib/inittest.sh | 2 ++
test/shell/multi_hosts_vg_hosta.sh | 45 +++++++++++++++++++++++++++++++++
test/shell/multi_hosts_vg_hostb.sh | 52 ++++++++++++++++++++++++++++++++++++++
4 files changed, 100 insertions(+)
diff --git a/test/Makefile.in b/test/Makefile.in
index 573df77a7..cd134129b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -93,6 +93,7 @@ help:
@echo -e "\nSupported variables:"
@echo " LVM_TEST_AUX_TRACE Set for verbose messages for aux scripts []."
@echo " LVM_TEST_BACKING_DEVICE Set device used for testing (see also LVM_TEST_DIR)."
+ @echo " LVM_TEST_MULTI_HOST Set multiple hosts used for testing."
@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_PREFER_BRD Prefer using brd (ramdisk) over loop for testing [1]."
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index 98a916ca6..4ca8ac59e 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -32,6 +32,7 @@ LVM_TEST_DEVDIR=${LVM_TEST_DEVDIR-}
LVM_TEST_NODEBUG=${LVM_TEST_NODEBUG-}
LVM_TEST_LVM1=${LVM_TEST_LVM1-}
LVM_TEST_FAILURE=${LVM_TEST_FAILURE-}
+LVM_TEST_MULTI_HOST=${LVM_TEST_MULTI_HOST-}
# TODO: LVM_TEST_SHARED
SHARED=${SHARED-}
@@ -65,6 +66,7 @@ test -n "$SKIP_WITH_LVMLOCKD" && test -n "$LVM_TEST_LVMLOCKD" && initskip
unset CDPATH
export LVM_TEST_BACKING_DEVICE LVM_TEST_DEVDIR LVM_TEST_NODEBUG LVM_TEST_FAILURE
+export LVM_TEST_MULTI_HOST
export LVM_TEST_LVMLOCKD LVM_TEST_LVMLOCKD_TEST
export LVM_TEST_LVMPOLLD LVM_TEST_LOCK_TYPE_DLM LVM_TEST_LOCK_TYPE_SANLOCK LVM_TEST_LOCK_TYPE_IDM
export LVM_TEST_DEVICES_FILE
diff --git a/test/shell/multi_hosts_vg_hosta.sh b/test/shell/multi_hosts_vg_hosta.sh
new file mode 100644
index 000000000..15347490c
--- /dev/null
+++ b/test/shell/multi_hosts_vg_hosta.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing, the paired scripts
+# are: multi_hosts_vg_hosta.sh / multi_hosts_vg_hostb.sh
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+i=0
+for d in "${BLKDEVS[@]}"; do
+ echo $i
+ i=$((i+1))
+ vgcreate $SHARED TESTVG$i $d
+ vgchange -a n TESTVG$i
+done
diff --git a/test/shell/multi_hosts_vg_hostb.sh b/test/shell/multi_hosts_vg_hostb.sh
new file mode 100644
index 000000000..bab65b68b
--- /dev/null
+++ b/test/shell/multi_hosts_vg_hostb.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This testing script is for multi-hosts testing, the paired scripts
+# are: multi_hosts_vg_hosta.sh / multi_hosts_vg_hostb.sh
+#
+# On the host A:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hosta.sh
+# On the host B:
+# make check_lvmlockd_idm \
+# LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
+# LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hostb.sh
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_MULTI_HOST" ] && skip;
+
+IFS=',' read -r -a BLKDEVS <<< "$LVM_TEST_BACKING_DEVICE"
+
+for d in "${BLKDEVS[@]}"; do
+ aux extend_filter_LVMTEST "a|$d|"
+done
+
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgchange --lock-start
+
+i=0
+for d in "${BLKDEVS[@]}"; do
+ i=$((i+1))
+ check vg_field TESTVG$i lv_count 0
+done
+
+i=0
+for d in "${BLKDEVS[@]}"; do
+ i=$((i+1))
+ vgchange -a ey TESTVG$i
+ vgremove -ff TESTVG$i
+done
2 years, 10 months
main - tests: idm: Add testing for IDM lock manager failure
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=92b47d8eb8c4b717fd7...
Commit: 92b47d8eb8c4b717fd79d0b7c50ecac0dceb31a5
Parent: 38abd6bb2c3c35ad476f11fd3cd4ee8d119e364d
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:21 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: idm: Add testing for IDM lock manager failure
If the IDM lock manager fails to access drives, might partially fail to
access drives (e.g. it fails to access one of three drives), or totally
fail to access drives, the lock manager should handle properly for these
cases. When the drives are partially failure, if the lock manager still
can renew the lease for the locking, then it doesn't need to take any
action for the drive failure; otherwise, if it detects it cannot renew
the locking majority, it needs ti immediately kill the VG from the
lvmlockd.
This patch adds the test for verification the IDM lock manager failure;
the command can be used as below:
# make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdp3,/dev/sdl3,/dev/sdq3 \
LVM_TEST_FAILURE=1 T=idm_ilm_failure.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/idm_ilm_failure.sh | 80 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/test/shell/idm_ilm_failure.sh b/test/shell/idm_ilm_failure.sh
new file mode 100644
index 000000000..58bed270e
--- /dev/null
+++ b/test/shell/idm_ilm_failure.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+[ -z "$LVM_TEST_FAILURE" ] && skip;
+
+aux prepare_devs 3
+aux extend_filter_LVMTEST
+
+DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE3=`dmsetup deps -o devname $dev3 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+
+if [ "$DRIVE1" = "$DRIVE2" ] || [ "$DRIVE1" = "$DRIVE3" ] || [ "$DRIVE2" = "$DRIVE3" ]; then
+ die "Need to pass three different drives!?"
+fi
+
+# The previous device-mapper are removed, but LVM still can directly
+# access VGs from the specified physical drives. So enable drives
+# for these drives.
+aux extend_filter_LVMTEST "a|/dev/$DRIVE1*|" "a|/dev/$DRIVE2*|" "a|/dev/$DRIVE3*|"
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
+
+# Create new logic volume and deactivate it
+lvcreate -a y --zero n -l 1 -n $lv1 $vg
+
+# Inject failure 40% so cannot send partially request to drives
+idm_inject_failure 40
+
+# Wait for 40s, but the lock will not be time out
+sleep 40
+
+# Inject failure with 0% so can access drives
+idm_inject_failure 0
+
+# Deactivate logic volume due to locking failure
+lvchange $vg/$lv1 -a n
+
+# Inject failure 100% so cannot send request to drives
+idm_inject_failure 100
+
+# Wait for 70s but should have no any alive locks
+sleep 70
+
+# Inject failure with 0% so can access drives
+idm_inject_failure 0
+
+# Activate logic volume
+lvchange $vg/$lv1 -a y
+
+# Inject failure so cannot send request to drives
+idm_inject_failure 100
+
+# Wait for 70s but will not time out
+sleep 70
+
+# Inject failure with 0% so can access drives
+idm_inject_failure 0
+
+check grep_lvmlockd_dump "S lvm_$vg kill_vg"
+lvmlockctl --drop $vg
+
+vgchange --lock-start
+vgremove -f $vg
2 years, 10 months
main - tests: idm: Add testing for the fabric's half brain failure
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=38abd6bb2c3c35ad476...
Commit: 38abd6bb2c3c35ad476f11fd3cd4ee8d119e364d
Parent: 91d3b568758cbb11ffd797c864d03f7f36426efc
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:20 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: idm: Add testing for the fabric's half brain failure
If the fabric is broken instantly and the partial drives connected on
the fabric disappear from the system. For this case, according to the
locking algorithm in idm, the lease will not lose since the half drives
are still alive so can renew the lease for the half drives. On the
other hand, since the VG lock requires to acquire the majority of drive
number, but half drives failure cannot achieve the majority, so it
cannot acquire the lock for VG and thus cannot change metadata for VG.
This patch is to add half brain failure for idm; the test command is as
below:
# make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdp3,/dev/sdo3 LVM_TEST_FAILURE=1 \
T=idm_fabric_failure_half_brain.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/idm_fabric_failure_half_brain.sh | 78 +++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/test/shell/idm_fabric_failure_half_brain.sh b/test/shell/idm_fabric_failure_half_brain.sh
new file mode 100644
index 000000000..c692a12ad
--- /dev/null
+++ b/test/shell/idm_fabric_failure_half_brain.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+[ -z "$LVM_TEST_FAILURE" ] && skip;
+
+aux prepare_devs 2
+aux extend_filter_LVMTEST
+
+DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+
+[ "$(basename -- $DRIVE1)" = "$(basename -- $DRIVE2)" ] && die "Need to pass two different drives!?"
+
+# The previous device-mapper are removed, but LVM still can directly
+# access VGs from the specified physical drives. So enable drives
+# for these drives.
+aux extend_filter_LVMTEST "a|/dev/$DRIVE1*|" "a|/dev/$DRIVE2*|"
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgcreate $SHARED $vg "$dev1" "$dev2"
+
+# Create new logic volume
+lvcreate -a ey --zero n -l 100%FREE -n $lv1 $vg
+
+drive_list=($DRIVE1)
+
+# Find all drives with the same WWN and delete them from system,
+# so that we can emulate the same drive with multiple paths are
+# disconnected with system.
+drive_wwn=`udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}'`
+for dev in /dev/*; do
+ if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
+ wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ if [ "$wwn" = "$drive_wwn" ]; then
+ base_name="$(basename -- ${dev})"
+ drive_list+=("$base_name")
+ host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ fi
+ fi
+done
+
+for d in "${drive_list[@]}"; do
+ [ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete
+done
+
+# Fail to create new logic volume
+not lvcreate -a n --zero n -l 1 -n $lv2 $vg
+
+# Wait for lock time out caused by drive failure
+sleep 70
+
+not check grep_lvmlockd_dump "S lvm_$vg kill_vg"
+
+# Rescan drives so can probe the deleted drives and join back them
+for h in "${host_list[@]}"; do
+ [ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan
+done
+
+# After the drive is reconnected, $vg should be visible again.
+vgchange --lock-start
+lvremove -f $vg/$lv1
+lvcreate -a ey --zero n -l 1 -n $lv2 $vg
+vgremove -ff $vg
2 years, 10 months
main - tests: idm: Add testing for the fabric failure and timeout
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=91d3b568758cbb11ffd...
Commit: 91d3b568758cbb11ffd797c864d03f7f36426efc
Parent: fc0495ea04a96c0990726db98c80bd2732d3695a
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:19 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: idm: Add testing for the fabric failure and timeout
If the fabric is broken instantly, the drives connected on the fabric
will disappear from the system. For worst case, the lease is timeout
and the drives cannot recovery back. So a new test is added to emulate
this scenario, it uses a drive for LVM operations and this drive is also
used for locking scheme; if the drive and all its associated paths (if
the drive supports multiple paths) are disconnected, the lock manager
should stop the lockspace for the VG/LVs.
And afterwards, if the drive recovers back, the VG/LV resident in the
drive should be operated properly. The test command is as below:
# make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdp3 LVM_TEST_FAILURE=1 \
T=idm_fabric_failure_timeout.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/idm_fabric_failure_timeout.sh | 74 ++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/test/shell/idm_fabric_failure_timeout.sh b/test/shell/idm_fabric_failure_timeout.sh
new file mode 100644
index 000000000..cf71f7609
--- /dev/null
+++ b/test/shell/idm_fabric_failure_timeout.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+[ -z "$LVM_TEST_FAILURE" ] && skip;
+
+aux prepare_devs 1
+aux extend_filter_LVMTEST
+
+DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+
+# The previous device-mapper are removed, but LVM still can directly
+# access VGs from the specified physical drives. So enable drives
+# for these drives.
+aux extend_filter_LVMTEST "a|/dev/$DRIVE1*|"
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+vgcreate $SHARED $vg "$dev1"
+
+# Create new logic volume
+lvcreate -a ey --zero n -l 1 -n $lv1 $vg
+
+drive_list=($DRIVE1)
+
+# Find all drives with the same WWN and delete them from system,
+# so that we can emulate the same drive with multiple paths are
+# disconnected with system.
+drive_wwn=`udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}'`
+for dev in /dev/*; do
+ if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
+ wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ if [ "$wwn" = "$drive_wwn" ]; then
+ base_name="$(basename -- ${dev})"
+ drive_list+=("$base_name")
+ host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ fi
+ fi
+done
+
+for d in "${drive_list[@]}"; do
+ [ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete
+done
+
+# Fail to create new logic volume
+not lvcreate -a n --zero n -l 1 -n $lv2 $vg
+
+# Wait for lock time out caused by drive failure
+sleep 70
+
+check grep_lvmlockd_dump "S lvm_$vg kill_vg"
+lvmlockctl --drop $vg
+
+# Rescan drives so can probe the deleted drives and join back them
+for h in "${host_list[@]}"; do
+ [ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan
+done
+
+# After the drive is reconnected, $vg should be visible again.
+vgchange --lock-start
+vgremove -ff $vg
2 years, 10 months
main - tests: idm: Add testing for the fabric failure
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fc0495ea04a96c09907...
Commit: fc0495ea04a96c0990726db98c80bd2732d3695a
Parent: 874001ee6e0e7812e4e8d19994a1fd7de43d3249
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Thu Jun 3 17:59:18 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 3 09:39:32 2021 -0500
tests: idm: Add testing for the fabric failure
When the fabric failure occurs, it will lose the connection with hosts
instantly, and after a while it can recovery back so that the hosts can
continue to access the drives.
For this case, the locking manager should be reliable for this case and
can dynamically handle this case and allows user to continue to use the
VG/LV with associated locking scheme.
This patch adds a testing to emulate the fabric faliure, verify LVM
commands for this case. The testing usage is:
# make check_lvmlockd_idm \
LVM_TEST_BACKING_DEVICE=/dev/sdo3,/dev/sdp3,/dev/sdp4 \
LVM_TEST_FAILURE=1 T=idm_fabric_failure.sh
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/idm_fabric_failure.sh | 58 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/test/shell/idm_fabric_failure.sh b/test/shell/idm_fabric_failure.sh
new file mode 100644
index 000000000..e68d6ad07
--- /dev/null
+++ b/test/shell/idm_fabric_failure.sh
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Seagate, 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 v2.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+[ -z "$LVM_TEST_FAILURE" ] && skip;
+
+aux prepare_devs 3
+aux extend_filter_LVMTEST
+
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
+
+# Create new logic volume
+lvcreate -a ey --zero n -l 50%FREE -n $lv1 $vg
+
+DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE3=`dmsetup deps -o devname $dev3 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+
+HOST1=`readlink /sys/block/$DRIVE1 | awk -F'/' '{print $6}'`
+HOST2=`readlink /sys/block/$DRIVE2 | awk -F'/' '{print $6}'`
+HOST3=`readlink /sys/block/$DRIVE3 | awk -F'/' '{print $6}'`
+
+# Emulate fabric failure
+echo 1 > /sys/block/$DRIVE1/device/delete
+[ -f /sys/block/$DRIVE2/device/delete ] && echo 1 > /sys/block/$DRIVE2/device/delete
+[ -f /sys/block/$DRIVE3/device/delete ] && echo 1 > /sys/block/$DRIVE3/device/delete
+
+# Wait for 10s and will not lead to timeout
+sleep 10
+
+# Rescan drives so can probe the deleted drives and join back them
+echo "- - -" > /sys/class/scsi_host/${HOST1}/scan
+echo "- - -" > /sys/class/scsi_host/${HOST2}/scan
+echo "- - -" > /sys/class/scsi_host/${HOST3}/scan
+
+not check grep_lvmlockd_dump "S lvm_$vg kill_vg"
+
+# The previous device-mapper are removed, but LVM still can directly
+# access VGs from the specified physical drives. So enable drives
+# for these drives.
+aux extend_filter_LVMTEST "a|/dev/$DRIVE1*|" "a|/dev/$DRIVE2*|" "a|/dev/$DRIVE3*|"
+aux lvmconf "devices/allow_changes_with_duplicate_pvs = 1"
+
+lvcreate -a n --zero n -l 10 -n $lv2 $vg
+
+vgremove -ff $vg
2 years, 10 months