1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2023-04-24 23:46:50 +02:00
parent 5e4c0701d9
commit a51b6d5e42

View File

@ -675,6 +675,9 @@ prepare_loop() {
prepare_ramdisk() { prepare_ramdisk() {
local size=$1 local size=$1
# if brd is unused, remove and use for test
modprobe -r brd || return 0
echo -n "## preparing ramdisk device..." echo -n "## preparing ramdisk device..."
modprobe brd rd_size=$((size * 1024)) || return modprobe brd rd_size=$((size * 1024)) || return