1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: improve check raid_leg_status

Enhance function to wait until raid status gets consisten
(shifts from 0/xxxxx to something else)

If it would took too long fail the check.
This commit is contained in:
Zdenek Kabelac 2021-03-24 16:05:03 +01:00
parent 0783c661b9
commit c1f5ca6751

View File

@ -436,10 +436,19 @@ sysfs() {
raid_leg_status() { raid_leg_status() {
local st local st
local val local val
st=$(dmsetup status "$1-$2")
val=$(echo "$st" | cut -d ' ' -f 6) # Ignore inconsisten raid status 0/xxxxx idle
test "$val" = "$3" || \ for i in {100..0} ; do
die "$1-$2 status $val != $3 ($st)" st=( $(dmsetup status $1-$2) ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${st[6]}" | sed s:/:' ':) )
[ "${b[0]}" = "0" ] || {
test "${st[5]}" = "$3" || break
return 0
}
sleep .1
done
die "$1-$2 status ${st[5]} != $3 ($st)"
} }
grep_dmsetup() { grep_dmsetup() {