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() {