mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
tests: check.sh simplify in_sync
Avoid calling sed.
This commit is contained in:
parent
5ab2676bac
commit
41e11e0f21
@ -194,15 +194,13 @@ linear() {
|
|||||||
in_sync() {
|
in_sync() {
|
||||||
local a
|
local a
|
||||||
local b
|
local b
|
||||||
|
local c
|
||||||
local idx
|
local idx
|
||||||
local type
|
local type
|
||||||
local snap=""
|
local snap=""
|
||||||
local lvm_name="$1/$2"
|
local lvm_name="$1/$2"
|
||||||
local ignore_a=$3
|
local ignore_a=${3:-0}
|
||||||
local dm_name
|
local dm_name="$1-$2"
|
||||||
|
|
||||||
dm_name=$(echo "$lvm_name" | sed s:-:--: | sed s:/:-:)
|
|
||||||
[ -z "$ignore_a" ] && ignore_a=0
|
|
||||||
|
|
||||||
a=( $(dmsetup status "$dm_name") ) || \
|
a=( $(dmsetup status "$dm_name") ) || \
|
||||||
die "Unable to get sync status of $1"
|
die "Unable to get sync status of $1"
|
||||||
@ -233,9 +231,10 @@ in_sync() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
b=( $(echo "${a[$idx]}" | sed s:/:' ':) )
|
b=${a[$idx]%%/*} # split ratio x/y
|
||||||
|
c=${a[$idx]##*/}
|
||||||
|
|
||||||
if [ "${b[0]}" -eq 0 ] || [ "${b[0]}" != "${b[1]}" ]; then
|
if [ "$b" -eq 0 ] || [ "$b" != "$c" ]; then
|
||||||
echo "$lvm_name ($type$snap) is not in-sync"
|
echo "$lvm_name ($type$snap) is not in-sync"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user