summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2023-04-24 23:46:50 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2023-04-25 00:12:31 +0200
commita51b6d5e4269ba4a5b335a3894873c750c2e8384 (patch)
tree504c64d234aaeb065aecbde4a15df438787602d4
parent5e4c0701d9d37eaa46468319c4df8f221acd38b3 (diff)
downloadlvm2-a51b6d5e4269ba4a5b335a3894873c750c2e8384.tar.gz
aux: use unused brd device for testing
When 'brd' device can be removed (is unused AKA not opened), remove such device and use again for testing. Let's assume user has no unused brd device left in the system. When the 'tests' sometimes fail to cleanup devices, with this change futher cleanup from some next test may evenually release brd device and make it available for testing.
-rw-r--r--test/lib/aux.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 8b04e1d30..b2660b65c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -675,6 +675,9 @@ prepare_loop() {
prepare_ramdisk() {
local size=$1
+ # if brd is unused, remove and use for test
+ modprobe -r brd || return 0
+
echo -n "## preparing ramdisk device..."
modprobe brd rd_size=$((size * 1024)) || return