summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-10-07 15:07:15 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-10-13 16:02:20 +0200
commit2cb1f6eafeb72dcd49a7ed941d9c5400540284fa (patch)
tree27527131e87bdc25f4ec56dc495cc89fb2b9c7a3
parent93229184066a9b7726e3b572bca3f612ed2815fb (diff)
downloadlvm2-2cb1f6eafeb72dcd49a7ed941d9c5400540284fa.tar.gz
tests: show status in in_sync
Make visible actual status line when returing 'raid' is in sync. Useful to prove when kernel is wrong.
-rw-r--r--test/lib/check.sh25
1 files changed, 14 insertions, 11 deletions
diff --git a/test/lib/check.sh b/test/lib/check.sh
index b47bc8b8f..74a6eb6ce 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -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() {