diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-03-28 13:29:44 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-03-28 14:22:11 +0200 |
commit | d9b97510324e7c16cf8ec61f511b6f5d71bff767 (patch) | |
tree | 8fffdcdd0b8da5a6f2ba391beb73f2ee6e62130b | |
parent | 0ddbc4c5cdbef0cc57b79c164b22b34c0bc6a27a (diff) | |
download | lvm2-d9b97510324e7c16cf8ec61f511b6f5d71bff767.tar.gz |
tests: add aux remove_dm_devs
Add function to remove DM devices and dies
if some device can't be removed.
-rw-r--r-- | test/lib/aux.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 38191842d..6177de4d4 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -1110,6 +1110,28 @@ enable_dev() { finish_udev_transaction } +# Try to remove list of DM device from table +remove_dm_devs() { + local remove=( "$@" ) + local held + local i + + for i in {1..50}; do + held=() + for d in "${remove[@]}" ; do + dmsetup remove "$d" 2>/dev/null || { + dmsetup info -c "$d" 2>/dev/null && { + held+=( "$d" ) + dmsetup status "$d" + } + } + done + test ${#held[@]} -eq 0 && return + remove=( "${held[@]}" ) + done + die "Can't remove device(s) ${held[@]}" +} + # Throttle down performance of kcopyd when mirroring i.e. disk image throttle_sys="/sys/module/dm_mirror/parameters/raid1_resync_throttle" throttle_dm_mirror() { |