Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93336685f6cf8a178cb83…
Commit: 93336685f6cf8a178cb83aa1ee113a2a33ca7f5c
Parent: 1d6e1d08a887d602234485f0214edc3552e843e0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 26 20:21:57 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 26 20:39:41 2021 +0100
tests: update dbus test_nesting
Test has to use PV with suffix pv[0..9] otherwise
it's ignored by test suite filter.
Better fix for VG names to use prefix LVMTEST.
Skip the test for runs without LVM_TEST_DEVDIR != /dev
---
test/dbus/lvmdbustest.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 6dab312c0..746025903 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -26,6 +26,9 @@ g_tmo = 0
# Prefix on created objects to enable easier clean-up
g_prefix = os.getenv('PREFIX', '')
+# Check dev dir prefix for test suite (LVM_TEST_DEVDIR
+dm_dev_dir = os.getenv('DM_DEV_DIR', '/dev')
+
# Use the session bus instead of the system bus
use_session = os.getenv('LVM_DBUSD_USE_SESSION', False)
@@ -59,10 +62,10 @@ if pv_device_list:
def vg_n(prefix=None):
- name = g_prefix + '_vg'
+ name = rs(8, '_vg')
if prefix:
name = prefix + name
- return name
+ return g_prefix + name
def lv_n(suffix=None):
@@ -70,7 +73,7 @@ def lv_n(suffix=None):
s = '_lv'
else:
s = suffix
- return g_prefix + rs(8, s)
+ return rs(8, s)
def _is_testsuite_pv(pv_name):
@@ -338,7 +341,7 @@ class TestDbusService(unittest.TestCase):
if not pv_paths:
pv_paths = self._all_pv_object_paths()
- vg_name = vg_n(prefix=vg_prefix)
+ vg_name = vg_n()
vg_path = self.handle_return(
self.objs[MANAGER_INT][0].Manager.VgCreate(
@@ -1811,7 +1814,7 @@ class TestDbusService(unittest.TestCase):
pv_object_path, vg.Vg.Pvs, "Expecting PV object path in Vg.Pvs")
lv = self._create_lv(
- vg=vg.Vg, size=vg.Vg.FreeBytes, suffix="_pv")
+ vg=vg.Vg, size=vg.Vg.FreeBytes, suffix="_pv0")
device_path = '/dev/%s/%s' % (vg.Vg.Name, lv.LvCommon.Name)
new_pv_object_path = self._pv_create(device_path)
@@ -1837,6 +1840,9 @@ class TestDbusService(unittest.TestCase):
# by editing lvm.conf with "devices/scan_lvs = 1" As testing
# typically utilizes loopback, this test is skipped in
# those environments.
+
+ if dm_dev_dir != '/dev':
+ raise unittest.SkipTest('test not running in real /dev')
pv_object_path = self.objs[PV_INT][0].object_path
if not self.objs[PV_INT][0].Pv.Name.startswith("/dev"):
raise unittest.SkipTest('test not running in /dev')
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=02e02a5ccc7275c23e59e…
Commit: 02e02a5ccc7275c23e59e65df25287c8f82276fa
Parent: 4c59b2aa216cb5649fe5e3f54230e85ee994869b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 26 16:07:24 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 26 20:39:41 2021 +0100
tests: use aux mdadm_assemble wrapper
---
test/shell/lvm-on-md.sh | 19 ++-----------------
test/shell/pvcreate-md-fake-hdr.sh | 4 ++--
2 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
index 7c14e6748..d2810b8cf 100644
--- a/test/shell/lvm-on-md.sh
+++ b/test/shell/lvm-on-md.sh
@@ -27,19 +27,6 @@ _clear_online_files() {
. lib/inittest
-which mdadm || skip
-
-STRACE=
-[ "$DM_DEV_DIR" = "/dev" ] && mdadm -V 2>&1 | grep " v3.2" && {
- # use this 'trick' to slow down mdadm which otherwise
- # is racing with udev rule since mdadm internally
- # opens and closes raid leg devices in RW mode and then
- # tries to get exlusive access to the leg device during
- # insertion to kernel and fails during assembly
- # There could be more affted version of mdadm.
- STRACE="strace -f -o /dev/null"
-}
-
# This stops lvm from taking advantage of hints which
# will have already excluded md components.
@@ -121,8 +108,7 @@ test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
not dmsetup info $vg-$lv1
-$STRACE mdadm --assemble "$mddev" "$dev1" "$dev2"
-aux udev_wait
+aux mdadm_assemble "$mddev" "$dev1" "$dev2"
not pvs "$dev1"
not pvs "$dev2"
@@ -276,8 +262,7 @@ test ! -f "$RUNDIR/lvm/vgs_online/$vg"
not dmsetup info $vg-$lv1
# start the md dev
-$STRACE mdadm --assemble "$mddev" "$dev1" "$dev2"
-aux udev_wait
+aux mdadm_assemble "$mddev" "$dev1" "$dev2"
not pvs "$dev1"
not pvs "$dev2"
diff --git a/test/shell/pvcreate-md-fake-hdr.sh b/test/shell/pvcreate-md-fake-hdr.sh
index 1550bc4c0..7a16ef5e4 100644
--- a/test/shell/pvcreate-md-fake-hdr.sh
+++ b/test/shell/pvcreate-md-fake-hdr.sh
@@ -88,8 +88,8 @@ if mdadm --detail "$mddev" ; then
fi
# now reassemble array from PV1 & PV2
-mdadm --assemble --verbose "$mddev" "$dev1" "$dev2"
-aux udev_wait
+aux mdadm_assemble --verbose "$mddev" "$dev1" "$dev2"
+
sleep 1
# and let 'fake hdr' to be fixed from master/primary leg
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4c59b2aa216cb5649fe5e…
Commit: 4c59b2aa216cb5649fe5e3f54230e85ee994869b
Parent: 5ef8d845694c79683ebdbdeec69eb2e534f4b1d2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 26 16:05:42 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 26 20:39:41 2021 +0100
tests: add aux mdadm_assemble
Wrapper for slowed version of mdadm --assemble
---
test/lib/aux.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6cf86bc38..0ce2b8b07 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -780,6 +780,22 @@ mdadm_create() {
done
}
+mdadm_assemble() {
+ STRACE=
+ [ "$DM_DEV_DIR" = "/dev" ] && mdadm -V 2>&1 | grep " v3.2" && {
+ # use this 'trick' to slow down mdadm which otherwise
+ # is racing with udev rule since mdadm internally
+ # opens and closes raid leg devices in RW mode and then
+ # tries to get exlusive access to the leg device during
+ # insertion to kernel and fails during assembly
+ # There can be some other affected version of mdadm.
+ STRACE="strace -f -o /dev/null"
+ }
+
+ $STRACE mdadm --assemble "$@"
+ udev_wait
+}
+
cleanup_md_dev() {
local IFS=$IFS_NL
local i