All of lore.kernel.org
 help / color / mirror / Atom feed
* dev-next - tests: aux clean DM on top of MD
@ 2021-03-31 21:49 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2021-03-31 21:49 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dd1f5f9a24fc906de7e6dd064ecdd8fdfa9eebda
Commit:        dd1f5f9a24fc906de7e6dd064ecdd8fdfa9eebda
Parent:        93f2d194aca4a589cd38dd8bdd99cad2945dd21c
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Mar 23 21:28:28 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Tue Mar 23 21:28:28 2021 +0100

tests: aux clean DM on top of MD

Before cleaning MD, try to remove any DM on top such MD.
Check is made through DM table check.
Maybe parse /proc/mdstat for this???
---
 test/lib/aux.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 386918041..08eeac55b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -783,11 +783,21 @@ cleanup_md_dev() {
 	mddev=$(< MD_DEV)
 	base=$(basename "$mddev")
 
+	# try to find and remove any DM device on top of cleaned MD
+	# assume  /dev/mdXXX is  9:MINOR
+	local minor=${mddev##/dev/md}
+	for i in $(dmsetup table | grep 9:$minor | cut -d: -f1) ; do
+		dmsetup remove $i || {
+			dmsetup --force remove $i || true
+		}
+	done
+
 	for i in {0..10} ; do
 		grep -q "$base" /proc/mdstat || break
 		test "$i" = 0 || {
 			sleep .1
 			echo "$mddev is still present, stopping again"
+			cat /proc/mdstat
 		}
 		mdadm --stop "$mddev" || true
 		udev_wait  # wait till events are process, not zeroing to early



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-31 21:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-31 21:49 dev-next - tests: aux clean DM on top of MD David Teigland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.