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

tests: show status in in_sync

Make visible actual status line when returing 'raid' is in sync.
Useful to prove when kernel is wrong.
This commit is contained in:
Zdenek Kabelac 2015-10-07 15:07:15 +02:00
parent 9322918406
commit 2cb1f6eafe

View File

@ -189,16 +189,17 @@ in_sync() {
local lvm_name="$1/$2"
local dm_name=$(echo $lvm_name | sed s:-:--: | sed s:/:-:)
if ! a=(`dmsetup status $dm_name`); then
a=( $(dmsetup status $dm_name) ) || \
die "Unable to get sync status of $1"
elif [ ${a[2]} = "snapshot-origin" ]; then
if ! a=(`dmsetup status ${dm_name}-real`); then
if [ ${a[2]} = "snapshot-origin" ]; then
a=( $(dmsetup status ${dm_name}-real) ) || \
die "Unable to get sync status of $1"
fi
snap=": under snapshot"
fi
if [ ${a[2]} = "raid" ]; then
case ${a[2]} in
"raid")
# 6th argument is the sync ratio for RAID
idx=6
type=${a[3]}
@ -206,13 +207,16 @@ in_sync() {
echo "$lvm_name ($type$snap) is not in-sync"
return 1
fi
elif [ ${a[2]} = "mirror" ]; then
;;
"mirror")
# 4th Arg tells us how far to the sync ratio
idx=$((${a[3]} + 4))
type=${a[2]}
else
;;
*)
die "Unable to get sync ratio for target type '${a[2]}'"
fi
;;
esac
b=( $(echo ${a[$idx]} | sed s:/:' ':) )
@ -221,11 +225,10 @@ in_sync() {
return 1
fi
if [[ ${a[$(($idx - 1))]} =~ a ]]; then
[[ ${a[$(($idx - 1))]} =~ a ]] && \
die "$lvm_name ($type$snap) in-sync, but 'a' characters in health status"
fi
echo "$lvm_name ($type$snap) is in-sync"
echo "$lvm_name ($type$snap) is in-sync \"${a[@]}\""
}
active() {