2013-06-10 13:28:47 +04:00
#!/usr/bin/env bash
2013-09-16 13:18:31 +04:00
# Copyright (C) 2010-2013 Red Hat, Inc. All rights reserved.
2010-07-28 16:20:38 +04:00
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2010-07-28 16:20:38 +04:00
2010-05-12 14:08:35 +04:00
# check.sh: assert various things about volumes
2012-03-16 16:59:43 +04:00
# USAGE:
2010-05-12 14:08:35 +04:00
# check linear VG LV
# check lv_on VG LV PV
# check mirror VG LV [LOGDEV|core]
# check mirror_nonredundant VG LV
# check mirror_legs VG LV N
# check mirror_images_on VG LV DEV [DEV...]
# ...
2012-03-16 16:59:43 +04:00
test -z " $BASH " || set -e -o pipefail
2011-01-05 03:16:18 +03:00
2012-03-16 16:59:43 +04:00
die( ) {
2013-09-16 13:05:03 +04:00
rm -f debug.log
echo -e " $@ " >& 2
2012-03-16 16:59:43 +04:00
return 1
2011-01-05 03:16:18 +03:00
}
2010-05-12 09:55:08 +04:00
lvl( ) {
lvs -a --noheadings " $@ "
}
2010-04-12 23:02:59 +04:00
lvdevices( ) {
2012-03-16 16:59:43 +04:00
get lv_devices " $@ "
2010-04-12 23:02:59 +04:00
}
2012-03-16 16:59:43 +04:00
mirror_images_redundant( ) {
local vg = $1
2017-07-04 12:55:17 +03:00
local lv = " $vg / $2 "
2017-06-29 09:23:23 +03:00
for i in $( lvdevices " $lv " ) ; do
2012-03-16 16:59:43 +04:00
echo " # $i : "
2017-06-29 09:23:23 +03:00
lvdevices " $vg / $i " | sort | uniq
2012-03-16 16:59:43 +04:00
done > check.tmp.all
2010-04-12 23:02:59 +04:00
2012-03-16 16:59:43 +04:00
( grep -v ^# check.tmp.all || true ) | sort | uniq -d > check.tmp
2010-04-12 23:02:59 +04:00
2017-06-29 12:56:47 +03:00
test " $( wc -l < check.tmp) " -eq 0 || \
2012-03-16 16:59:43 +04:00
die " mirror images of $lv expected redundant, but are not: " \
2017-06-29 09:23:23 +03:00
" $( cat check.tmp.all) "
2012-03-16 16:59:43 +04:00
}
2010-04-12 23:02:59 +04:00
2013-09-16 13:18:31 +04:00
lv_err_list_( ) {
( echo " $2 " | not grep -m 1 -q " $1 " ) || \
echo " $3 on [ $( echo " $2 " | grep " $1 " | cut -b3- | tr '\n' ' ' ) ] "
}
lv_on_diff_( ) {
2014-03-09 02:07:50 +04:00
declare -a xdevs = ( " ${ !1 } " ) # pass in shell array
2013-09-16 13:18:31 +04:00
local expect = ( " ${ @ : 4 } " ) # make an array starting from 4th args...
local diff_e
# Find diff between 2 shell arrays, print them as stdin files
2018-03-23 19:02:44 +03:00
printf "%s\\n" " ${ expect [@] } " | sort | uniq >_lv_on_diff1
printf "%s\\n" " ${ xdevs [@] } " >_lv_on_diff2
2013-12-04 22:50:53 +04:00
diff_e = $( diff _lv_on_diff1 _lv_on_diff2) ||
2013-09-16 13:18:31 +04:00
die " LV $2 / $3 $( lv_err_list_ "^>" " ${ diff_e } " found) $( lv_err_list_ "^<" " ${ diff_e } " "not found" ) . "
}
# list devices for given LV
2012-03-16 16:59:43 +04:00
lv_on( ) {
2013-09-16 13:18:31 +04:00
local devs
devs = ( $( lvdevices " $1 / $2 " | sort | uniq ) )
2017-07-04 12:55:17 +03:00
lv_on_diff_ devs[ @] " $@ "
2013-09-16 13:18:31 +04:00
}
# list devices for given LV and all its subdevices
lv_tree_on( ) {
local devs
# Get sorted list of devices
devs = ( $( get lv_tree_devices " $1 " " $2 " ) )
2017-07-04 12:55:17 +03:00
lv_on_diff_ devs[ @] " $@ "
2010-04-12 23:02:59 +04:00
}
2017-07-07 22:17:03 +03:00
# Test if all mimage_X LV legs are sitting on given ordered list of PVs
# When LV is composed of imagetmp, such leg is decomposed so only
# real _mimage LVs are always checked
2010-04-12 23:33:58 +04:00
mirror_images_on( ) {
2012-03-16 16:59:43 +04:00
local vg = $1
local lv = $2
2010-05-12 14:08:35 +04:00
shift 2
2017-07-07 22:17:03 +03:00
local mimages = ( )
2017-07-10 18:40:31 +03:00
local line
while IFS = read -r line ; do
mimages += ( " $line " )
done < <( get lv_field_lv_ " $vg " lv_name -a | grep " ${ lv } _mimage_ " )
2017-07-07 22:17:03 +03:00
for i in " ${ mimages [@] } " ; do
lv_on " $vg " " $i " " $1 "
2010-04-12 23:33:58 +04:00
shift
done
}
2012-03-16 16:59:43 +04:00
mirror_log_on( ) {
local vg = $1
local lv = $2
local where = $3
2010-05-12 14:08:35 +04:00
if test " $where " = "core" ; then
2017-06-29 09:23:23 +03:00
get lv_field " $vg / $lv " mirror_log | not grep mlog
2010-05-12 14:08:35 +04:00
else
2017-06-29 09:23:23 +03:00
lv_on " $vg " " ${ lv } _mlog " " $where "
2010-05-12 14:08:35 +04:00
fi
2010-04-12 23:02:59 +04:00
}
2012-03-16 16:59:43 +04:00
lv_is_contiguous( ) {
2017-07-04 12:55:17 +03:00
local lv = " $1 / $2 "
2017-06-29 09:23:23 +03:00
test " $( lvl --segments " $lv " | wc -l) " -eq 1 || \
2012-03-16 16:59:43 +04:00
die " LV $lv expected to be contiguous, but is not: " \
2017-06-29 09:23:23 +03:00
" $( lvl --segments " $lv " ) "
2010-04-12 23:02:59 +04:00
}
2012-03-16 16:59:43 +04:00
lv_is_clung( ) {
2017-07-04 12:55:17 +03:00
local lv = " $1 / $2 "
2017-06-29 09:23:23 +03:00
test " $( lvdevices " $lv " | sort | uniq | wc -l) " -eq 1 || \
2012-03-16 16:59:43 +04:00
die " LV $lv expected to be clung, but is not: " \
2017-06-29 09:23:23 +03:00
" $( lvdevices " $lv " | sort | uniq) "
2010-04-12 23:02:59 +04:00
}
2012-03-16 16:59:43 +04:00
mirror_images_contiguous( ) {
2017-06-29 09:23:23 +03:00
for i in $( lvdevices " $1 / $2 " ) ; do
lv_is_contiguous " $1 " " $i "
2010-04-12 23:02:59 +04:00
done
}
2012-03-16 16:59:43 +04:00
mirror_images_clung( ) {
2017-06-29 09:23:23 +03:00
for i in $( lvdevices " $1 / $2 " ) ; do
lv_is_clung " $1 " " $i "
2010-04-12 23:02:59 +04:00
done
}
mirror( ) {
2010-05-12 14:08:35 +04:00
mirror_nonredundant " $@ "
2017-06-29 09:23:23 +03:00
mirror_images_redundant " $1 " " $2 "
2010-05-12 14:08:35 +04:00
}
mirror_nonredundant( ) {
2017-06-29 09:23:23 +03:00
local lv = " $1 / $2 "
2017-06-29 09:39:21 +03:00
local attr
attr = $( get lv_field " $lv " attr)
2013-07-12 15:07:40 +04:00
( echo " $attr " | grep " ^......m... $" >/dev/null) || {
if ( echo " $attr " | grep " ^o......... $" >/dev/null) &&
2018-04-20 11:15:14 +03:00
lvs -a $1 | grep -F " [ ${ 2 } _mimage " >/dev/null; then
2011-01-07 16:03:46 +03:00
echo " TEST WARNING: $lv is a snapshot origin and looks like a mirror, "
echo "assuming it is actually a mirror"
else
2012-03-16 16:59:43 +04:00
die " $lv expected a mirror, but is not: " \
2017-06-29 09:23:23 +03:00
" $( lvs " $lv " ) "
2011-01-07 16:03:46 +03:00
fi
2010-04-12 23:02:59 +04:00
}
2017-06-29 09:23:23 +03:00
test -z " $3 " || mirror_log_on " $1 " " $2 " " $3 "
2010-04-12 23:02:59 +04:00
}
2010-05-06 23:01:26 +04:00
mirror_legs( ) {
2017-06-29 09:23:23 +03:00
local expect_legs = $3
test " $expect_legs " -eq " $( lvdevices " $1 / $2 " | wc -w) "
2010-05-06 23:01:26 +04:00
}
2012-03-16 16:59:43 +04:00
mirror_no_temporaries( ) {
local vg = $1
local lv = $2
2017-06-29 09:23:23 +03:00
( lvl -o name " $vg " | grep " $lv " | not grep "tmp" ) || \
2012-03-16 16:59:43 +04:00
die " $lv has temporary mirror images unexpectedly: " \
2017-06-29 09:23:23 +03:00
" $( lvl " $vg " | grep " $lv " ) "
2010-05-12 14:08:35 +04:00
}
2010-04-12 23:02:59 +04:00
linear( ) {
2017-06-29 09:23:23 +03:00
local lv = " $1 / $2 "
test " $( get lv_field " $lv " stripes -a) " -eq 1 || \
2012-03-16 16:59:43 +04:00
die " $lv expected linear, but is not: " \
2017-06-29 09:23:23 +03:00
" $( lvl " $lv " -o+devices) "
2010-05-12 09:55:08 +04:00
}
2017-02-24 06:36:03 +03:00
# in_sync <VG> <LV> <ignore 'a'>
2012-07-24 23:17:54 +04:00
# Works for "mirror" and "raid*"
in_sync( ) {
local a
local b
2017-07-11 14:29:54 +03:00
local c
2012-07-24 23:17:54 +04:00
local idx
local type
2013-06-20 20:48:15 +04:00
local snap = ""
2012-07-24 23:17:54 +04:00
local lvm_name = " $1 / $2 "
2017-07-11 14:29:54 +03:00
local ignore_a = ${ 3 :- 0 }
local dm_name = " $1 - $2 "
2017-02-24 06:36:03 +03:00
2017-06-29 09:23:23 +03:00
a = ( $( dmsetup status " $dm_name " ) ) || \
2012-07-24 23:17:54 +04:00
die " Unable to get sync status of $1 "
2015-10-07 16:07:15 +03:00
2017-06-29 09:23:23 +03:00
if [ " ${ a [2] } " = "snapshot-origin" ] ; then
a = ( $( dmsetup status " ${ dm_name } -real " ) ) || \
2012-07-24 23:17:54 +04:00
die " Unable to get sync status of $1 "
2013-06-20 20:48:15 +04:00
snap = ": under snapshot"
2012-07-24 23:17:54 +04:00
fi
2017-06-29 09:23:23 +03:00
case " ${ a [2] } " in
2015-10-07 16:07:15 +03:00
"raid" )
2013-03-06 21:12:09 +04:00
# 6th argument is the sync ratio for RAID
idx = 6
2012-07-24 23:17:54 +04:00
type = ${ a [3] }
2017-06-29 10:37:20 +03:00
if [ " ${ a [ $(( idx + 1 )) ] } " != "idle" ] ; then
2020-09-12 20:04:56 +03:00
echo " $lvm_name ( $type $snap ) is not in-sync " " ${ a [@] } "
2015-05-27 12:59:10 +03:00
return 1
fi
2015-10-07 16:07:15 +03:00
; ;
"mirror" )
2012-07-24 23:17:54 +04:00
# 4th Arg tells us how far to the sync ratio
2017-06-29 10:37:20 +03:00
idx = $(( a[ 3 ] + 4 ))
2012-07-24 23:17:54 +04:00
type = ${ a [2] }
2015-10-07 16:07:15 +03:00
; ;
*)
2012-07-24 23:17:54 +04:00
die " Unable to get sync ratio for target type ' ${ a [2] } ' "
2015-10-07 16:07:15 +03:00
; ;
esac
2012-07-24 23:17:54 +04:00
2017-07-11 14:29:54 +03:00
b = ${ a [ $idx ]%%/* } # split ratio x/y
c = ${ a [ $idx ]##*/ }
2012-07-24 23:17:54 +04:00
2017-07-11 14:29:54 +03:00
if [ " $b " -eq 0 ] || [ " $b " != " $c " ] ; then
2020-09-12 20:04:56 +03:00
echo " $lvm_name ( $type $snap ) is not in-sync " " ${ a [@] } "
2012-07-24 23:17:54 +04:00
return 1
fi
2017-06-29 10:37:20 +03:00
if [ [ ${ a [ $(( idx - 1 )) ] } = ~ a ] ] ; then
2018-03-23 19:01:13 +03:00
[ " $ignore_a " = 0 ] && \
2017-06-23 22:14:29 +03:00
die " $lvm_name ( $type $snap ) in-sync, but 'a' characters in health status "
2020-09-12 20:04:56 +03:00
echo " $lvm_name ( $type $snap ) is not in-sync " " ${ a [@] } "
2018-03-23 19:01:13 +03:00
[ " $ignore_a " = 1 ] && return 0
2017-06-23 22:14:29 +03:00
return 1
fi
2012-07-24 23:17:54 +04:00
2020-09-12 20:04:56 +03:00
echo " $lvm_name ( $type $snap ) is in-sync " " ${ a [@] } "
2012-07-24 23:17:54 +04:00
}
2010-05-12 09:55:08 +04:00
active( ) {
2017-06-29 09:23:23 +03:00
local lv = " $1 / $2 "
( get lv_field " $lv " attr | grep " ^....a..... $" >/dev/null) || \
2012-03-16 16:59:43 +04:00
die " $lv expected active, but lvs says it's not: " \
2017-06-29 09:23:23 +03:00
" $( lvl " $lv " -o+devices) "
dmsetup info " $1 - $2 " >/dev/null ||
2012-03-28 15:10:08 +04:00
die " $lv expected active, lvs thinks it is but there are no mappings! "
2010-05-12 09:55:08 +04:00
}
inactive( ) {
2017-06-29 09:23:23 +03:00
local lv = " $1 / $2 "
( get lv_field " $lv " attr | grep " ^....[-isd]..... $" >/dev/null) || \
2012-03-16 16:59:43 +04:00
die " $lv expected inactive, but lvs says it's not: " \
2017-06-29 09:23:23 +03:00
" $( lvl " $lv " -o+devices) "
not dmsetup info " $1 - $2 " 2>/dev/null || \
2014-01-31 16:31:40 +04:00
die " $lv expected inactive, lvs thinks it is but there are mappings! "
2010-04-12 23:02:59 +04:00
}
2012-03-16 16:59:43 +04:00
# Check for list of LVs from given VG
2011-04-12 16:39:24 +04:00
lv_exists( ) {
2012-03-16 16:59:43 +04:00
local vg = $1
2017-06-30 12:06:19 +03:00
declare -a list = ( )
2012-03-16 16:59:43 +04:00
while [ $# -gt 1 ] ; do
shift
2017-06-30 12:06:19 +03:00
list += ( " $vg / $1 " )
2012-03-16 16:59:43 +04:00
done
2017-06-30 12:06:19 +03:00
test " ${# list [@] } " -gt 0 || list = ( " $vg " )
lvl " ${ list [@] } " & >/dev/null || \
die " ${ list [@] } " "expected to exist, but does not!"
2011-04-12 16:39:24 +04:00
}
2014-01-31 16:31:40 +04:00
lv_not_exists( ) {
local vg = $1
if test $# -le 1 ; then
2017-06-29 09:23:23 +03:00
if lvl " $vg " & >/dev/null ; then
2014-09-15 15:45:43 +04:00
die " $vg expected to not exist but it does! "
fi
2014-01-31 16:31:40 +04:00
else
while [ $# -gt 1 ] ; do
shift
2017-06-29 09:23:23 +03:00
not lvl " $vg / $1 " & >/dev/null || die " $vg / $1 expected to not exist but it does! "
2014-01-31 16:31:40 +04:00
done
fi
2014-09-15 15:45:43 +04:00
rm -f debug.log
2014-01-31 16:31:40 +04:00
}
2012-03-16 16:59:43 +04:00
pv_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get pv_field " $1 " " $2 " " ${ @ : 4 } " )
2012-03-16 16:59:43 +04:00
test " $actual " = " $3 " || \
die " pv_field: PV=\" $1 \", field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
2011-01-05 03:16:18 +03:00
}
2012-03-16 16:59:43 +04:00
vg_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get vg_field " $1 " " $2 " " ${ @ : 4 } " )
2012-03-16 16:59:43 +04:00
test " $actual " = " $3 " || \
die " vg_field: vg= $1 , field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
2011-01-05 03:16:18 +03:00
}
2014-05-22 13:59:11 +04:00
vg_attr_bit( ) {
2017-06-29 09:39:21 +03:00
local actual
2014-05-22 13:59:11 +04:00
local offset = $1
2017-06-29 09:39:21 +03:00
actual = $( get vg_field " $2 " vg_attr " ${ @ : 4 } " )
2014-05-22 13:59:11 +04:00
case " $offset " in
perm*) offset = 0 ; ;
resiz*) offset = 1 ; ;
export*) offset = 2 ; ;
partial) offset = 3 ; ;
alloc*) offset = 4 ; ;
cluster*) offset = 5 ; ;
esac
test " ${ actual : $offset : 1 } " = " $3 " || \
die " vg_attr_bit: vg= $2 , ${ offset } bit of \" $actual \" is \" ${ actual : $offset : 1 } \", but expected \" $3 \" "
}
2012-03-16 16:59:43 +04:00
lv_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get lv_field " $1 " " $2 " " ${ @ : 4 } " )
2012-03-16 16:59:43 +04:00
test " $actual " = " $3 " || \
2014-04-11 00:07:45 +04:00
die " lv_field: lv= $1 , field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
2016-03-01 17:32:20 +03:00
}
2017-02-24 06:36:03 +03:00
lv_first_seg_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get lv_first_seg_field " $1 " " $2 " " ${ @ : 4 } " )
2017-02-24 06:36:03 +03:00
test " $actual " = " $3 " || \
die " lv_field: lv= $1 , field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
}
2016-03-01 17:32:20 +03:00
lvh_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get lvh_field " $1 " " $2 " " ${ @ : 4 } " )
2016-03-01 17:32:20 +03:00
test " $actual " = " $3 " || \
die " lvh_field: lv= $1 , field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
2014-04-11 00:07:45 +04:00
}
2015-08-21 23:06:00 +03:00
lva_field( ) {
2017-06-29 09:39:21 +03:00
local actual
actual = $( get lva_field " $1 " " $2 " " ${ @ : 4 } " )
2015-08-21 23:06:00 +03:00
test " $actual " = " $3 " || \
die " lva_field: lv= $1 , field=\" $2 \", actual=\" $actual \", expected=\" $3 \" "
}
2014-04-11 00:07:45 +04:00
lv_attr_bit( ) {
2017-06-29 09:39:21 +03:00
local actual
2014-04-11 00:07:45 +04:00
local offset = $1
2017-06-29 09:39:21 +03:00
actual = $( get lv_field " $2 " lv_attr " ${ @ : 4 } " )
2014-04-11 00:07:45 +04:00
case " $offset " in
type ) offset = 0 ; ;
perm*) offset = 1 ; ;
alloc*) offset = 2 ; ;
fixed*) offset = 3 ; ;
state) offset = 4 ; ;
open) offset = 5 ; ;
target) offset = 6 ; ;
zero) offset = 7 ; ;
health) offset = 8 ; ;
skip) offset = 9 ; ;
esac
test " ${ actual : $offset : 1 } " = " $3 " || \
die " lv_attr_bit: lv= $2 , ${ offset } bit of \" $actual \" is \" ${ actual : $offset : 1 } \", but expected \" $3 \" "
2011-01-05 03:16:18 +03:00
}
2012-03-16 16:59:43 +04:00
compare_fields( ) {
local cmd1 = $1
local obj1 = $2
local field1 = $3
local cmd2 = $4
local obj2 = $5
local field2 = $6
2017-06-29 09:39:21 +03:00
local val1
local val2
2017-07-10 11:40:09 +03:00
val1 = $( " $cmd1 " --noheadings -o " $field1 " " $obj1 " )
val2 = $( " $cmd2 " --noheadings -o " $field2 " " $obj2 " )
2012-03-16 16:59:43 +04:00
test " $val1 " = " $val2 " || \
die " compare_fields $obj1 ( $field1 ): $val1 $obj2 ( $field2 ): $val2 "
2011-01-05 03:16:18 +03:00
}
2012-03-16 16:59:43 +04:00
compare_vg_field( ) {
local vg1 = $1
local vg2 = $2
local field = $3
2017-06-29 09:39:21 +03:00
local val1
local val2
val1 = $( vgs --noheadings -o " $field " " $vg1 " )
val2 = $( vgs --noheadings -o " $field " " $vg2 " )
2012-03-16 16:59:43 +04:00
test " $val1 " = " $val2 " || \
die " compare_vg_field: $vg1 : $val1 , $vg2 : $val2 "
2011-01-05 03:16:18 +03:00
}
2012-03-16 16:59:43 +04:00
pvlv_counts( ) {
2011-01-05 03:16:18 +03:00
local local_vg = $1
local num_pvs = $2
local num_lvs = $3
local num_snaps = $4
2017-06-29 09:23:23 +03:00
lvs -o+devices " $local_vg "
vg_field " $local_vg " pv_count " $num_pvs "
vg_field " $local_vg " lv_count " $num_lvs "
vg_field " $local_vg " snap_count " $num_snaps "
2011-01-05 03:16:18 +03:00
}
2013-09-16 13:02:58 +04:00
# Compare md5 check generated from get dev_md5sum
dev_md5sum( ) {
md5sum -c " md5. $1 - $2 " || \
2017-06-29 09:23:23 +03:00
( get lv_field " $1 / $2 " "name,size,seg_pe_ranges"
2013-09-16 13:02:58 +04:00
die " LV $1 / $2 has different MD5 check sum! " )
}
2015-04-24 21:31:22 +03:00
sysfs( ) {
2015-04-03 11:27:00 +03:00
# read maj min and also convert hex to decimal
2017-06-29 09:39:21 +03:00
local maj
local min
2018-05-13 00:01:52 +03:00
local P
2017-06-29 09:39:21 +03:00
local val
maj = $(( $( stat -L --printf= 0x%t " $1 " ) ))
min = $(( $( stat -L --printf= 0x%T " $1 " ) ))
2018-05-13 00:01:52 +03:00
P = " /sys/dev/block/ $maj : $min / $2 "
2017-06-29 09:39:21 +03:00
val = $( < " $P " ) || return 0 # no sysfs ?
2015-04-03 11:27:00 +03:00
test " $val " -eq " $3 " || \
die " $1 : $P = $val differs from expected value $3 ! "
2015-04-02 13:21:55 +03:00
}
2016-09-13 12:27:36 +03:00
# check raid_leg_status $vg $lv "Aaaaa"
2016-09-12 16:44:09 +03:00
raid_leg_status( ) {
2017-06-29 09:39:21 +03:00
local st
local val
2021-03-24 18:05:03 +03:00
# Ignore inconsisten raid status 0/xxxxx idle
for i in { 100..0} ; do
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 ) "
2016-09-12 16:44:09 +03:00
}
2016-09-19 14:46:42 +03:00
grep_dmsetup( ) {
2017-06-29 09:23:23 +03:00
dmsetup " $1 " " $2 " | tee out
2017-06-29 09:40:55 +03:00
grep -q " ${ @ : 3 } " out || die "Expected output \"" " ${ @ : 3 } " " \" from dmsetup $1 not found! "
2016-09-19 14:46:42 +03:00
}
2013-09-16 13:02:58 +04:00
#set -x
2012-03-16 16:59:43 +04:00
unset LVM_VALGRIND
2010-04-12 23:02:59 +04:00
" $@ "