Skip to contentSkip to conversation

tests: Fix device mapping for global lock image

PATCH New Leo Yan 1 participant 4 messages Jun 25, 2020

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

PATCH 1/4 tests: Fix device mapping for global lock image

When create the sanlock global image device mapping, it needs to generate mapping table. The shell script uses the wrong command thus the mapping table is not created properly.

This patch fixes the device mapping table so allow the global image can be mapped successfully.

---
 test/shell/aa-lvmlockd-sanlock-prepare.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/shell/aa-lvmlockd-sanlock-prepare.sh +1 -1
index 4d0f9fd94..931055a22 100644
@@ -33,7 +33,7 @@ dmsetup remove GL_DEV || true
 rm -f "$GL_FILE"
 dd if=/dev/zero of="$GL_FILE" bs=$((1024*1024)) count=1024 2> /dev/null
 GL_LOOP=$(losetup -f "$GL_FILE" --show)
-echo "0 $(blockdev --getsize $GL_LOOP linear $GL_LOOP 0)" | dmsetup create GL_DEV
+echo "0 $(blockdev --getsize $GL_LOOP) linear $GL_LOOP 0" | dmsetup create GL_DEV
 
 aux prepare_sanlock
 aux prepare_lvmlockd
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/4 tests: Specify global locking 'sanlock' for lvmlockd

For sanlock locking scheme testing, it's good to specify the global locking type option '-g sanlock' for lvmlockd.

---
 test/lib/aux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/lib/aux.sh +1 -1
index 17e7935ee..214662f6e 100644
@@ -128,7 +128,7 @@ prepare_lvmlockd() {
 	if test -n "$LVM_TEST_LOCK_TYPE_SANLOCK"; then
 		# make check_lvmlockd_sanlock
 		echo "starting lvmlockd for sanlock"
-		lvmlockd -o 2
+		lvmlockd -o 2 -g sanlock
 
 	elif test -n "$LVM_TEST_LOCK_TYPE_DLM"; then
 		# make check_lvmlockd_dlm
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 3/4 tests: Fix test image issue

In reply to Leo Yan

If the global lock's test image gl_test.img is placed under the folder @TESTDIR, after execute the script aa-lvmlockd-sanlock-prepare.sh, the folder @TESTDIR is a temporary folder so it will be removed after running and thus gl_test.img will not be kept anymore. So gl_test.img cannot be used by any sequential test cases.

This patch changes to place gl_test.img in folder '/tmp' so it can be used by all test cases.

---
 test/shell/aa-lvmlockd-sanlock-prepare.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/shell/aa-lvmlockd-sanlock-prepare.sh +1 -1
index 931055a22..8a8c4a74b 100644
@@ -28,7 +28,7 @@ test_description='Set up things to run tests with sanlock'
 # to remove this VG and device.
 
 GL_DEV="/dev/mapper/GL_DEV"
-GL_FILE="$PWD/gl_file.img"
+GL_FILE="/tmp/gl_file.img"
 dmsetup remove GL_DEV || true
 rm -f "$GL_FILE"
 dd if=/dev/zero of="$GL_FILE" bs=$((1024*1024)) count=1024 2> /dev/null
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 4/4 tests: Cleanup device mapping for global lock LV

In reply to Leo Yan

Cleanup the device mapping for global locking LV before cleanup the device mapping for GL device, otherwise sometimes it will fail due to the dependency.

---
 test/shell/aa-lvmlockd-sanlock-prepare.sh | 1 +
 1 file changed, 1 insertion(+)
test/shell/aa-lvmlockd-sanlock-prepare.sh +1 -0
index 8a8c4a74b..3a20b4dec 100644
@@ -29,6 +29,7 @@ test_description='Set up things to run tests with sanlock'
 
 GL_DEV="/dev/mapper/GL_DEV"
 GL_FILE="/tmp/gl_file.img"
+dmsetup remove glvg-lvmlock || true
 dmsetup remove GL_DEV || true
 rm -f "$GL_FILE"
 dd if=/dev/zero of="$GL_FILE" bs=$((1024*1024)) count=1024 2> /dev/null
Signature · 1 line
2.17.1