Bash 3.2 doesn't understand this syntax (i.e. RHEL5).
And it's even better - reports syntax error and return success.
# Swaping of metadata volume
lvcreate -L1T -n $lv1 $vg
lvcreate -L32 -n $lv2 $vg
-lvconvert --yes -c 8M --type thin-pool $vg/$lv1 |& tee err
+lvconvert --yes -c 8M --type thin-pool $vg/$lv1 2>&1 | tee err
# Check tther is warning for large chunk size and zeroing enabled
grep "Pool zeroing and large" err
UUID=$(get lv_field $vg/$lv2 uuid)
invalid lvconvert --yes --thinpool $vg/$lv3 -T $vg/$lv3
# Warning about smaller then suggested
-lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
+lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 2>&1 | tee err
grep "WARNING: Chunk size is smaller" err
lvremove -f $vg
lvcreate -L1T -n $lv1 $vg
lvcreate -L32G -n $lv2 $vg
# Warning about bigger then needed
-lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
+lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 2>&1 | tee err
grep "WARNING: Maximum" err
lvremove -f $vg
if test "$TSIZE" = 64T; then
lvcreate -L24T -n $lv1 $vg
# Warning about bigger then needed (24T data and 16G -> 128K chunk)
-lvconvert --yes -c 64 --thinpool $vg/$lv1 |& tee err
+lvconvert --yes -c 64 --thinpool $vg/$lv1 2>&1 | tee err
grep "WARNING: Chunk size is too small" err
lvremove -f $vg
fi
fail lvcreate -l 1 --cachepool pool8 $vg
# no size specified
-invalid lvcreate --cachepool pool $vg |& tee err
+invalid lvcreate --cachepool pool $vg 2>&1 | tee err
grep "specify either size or extents" err
# Check nothing has been created yet
check lv_field $vg/$lv regionsize "4.00m"
# -m0 is creating non-mirrored segment and give info about redundant option
-lvcreate -m 0 -l1 -n $lv1 $vg |& tee err
+lvcreate -m 0 -l1 -n $lv1 $vg 2>&1 | tee err
grep "Redundant" err
check lv_field $vg/$lv1 segtype "linear"
lvremove -ff $vg
fail lvcreate --minor 9999999 -l1 $vg
if aux kernel_at_least 2 4 0; then
# On >2.4 we ignore --major
-lvcreate --major 234 -l1 $vg |& tee err;
+lvcreate --major 234 -l1 $vg 2>&1 | tee err;
grep "Ignoring" err
# Try some bigger possibly unused minor
if test ! -d /sys/block/dm-2345; then
pvcreate --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev2"
pvcreate --config "devices{filter=[\"a|$dev3|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev3"
-pvs -o+uuid |& tee out
+pvs -o+uuid 2>&1 | tee out
COUNT=$(should grep --count "Found duplicate" out)
# FIXME lvmetad is not able to serve properly this case
# Play with 1 extent
lvcreate -aey -l1 -n $lv $vg
# 100%LV is not supported for snapshot
-fail lvcreate -s -l 100%LV -n snap $vg/$lv |& tee out
+fail lvcreate -s -l 100%LV -n snap $vg/$lv 2>&1 | tee out
grep 'Please express size as %FREE, %ORIGIN, %PVS or %VG' out
# 100%ORIGIN needs to have enough space for all data and needs to round-up
lvcreate -s -l 100%ORIGIN -n $lv1 $vg/$lv
if [ ! -e /etc/machine-id ]; then
SID=""
aux lvmconf "global/system_id_source = machineid"
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
SID=""
rm -f $LVMLOCAL
aux lvmconf "global/system_id_source = lvmlocal"
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
# echo " system_id = $SID" >> $LVMLOCAL
echo "}" >> $LVMLOCAL
aux lvmconf "global/system_id_source = lvmlocal"
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
echo " system_id = \"\"" >> $LVMLOCAL
echo "}" >> $LVMLOCAL
aux lvmconf "global/system_id_source = lvmlocal"
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
SIDFILE=etc/lvm_test.conf
rm -f $SIDFILE
aux lvmconf "global/system_id_source = file"
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
rm -f $SIDFILE
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
-vgcreate $vg1 "$dev1" |& tee err
+vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
# set cluster bit
vgcreate -cn $vg "$dev1" "$dev2" "$dev3"
# check prompt to change cluster bit without giving explicit vg name
-fail vgchange -cy |& tee out
+fail vgchange -cy 2>&1 | tee out
grep "y/n" out
check vg_attr_bit cluster $vg "-"
# can't switch with active LV
vgchange --yes -cy $vg
fail vgchange --yes -cy $vg
- fail vgs $vg |& tee out
+ fail vgs $vg 2>&1 | tee out
grep "Skipping clustered volume group" out
- vgs --ignoreskippedcluster $vg |& tee out
+ vgs --ignoreskippedcluster $vg 2>&1 | tee out
not grep "Skipping clustered volume group" out
# reset back to non-clustered VG with disabled locking
vgchange -cn $vg --config 'global{locking_type=0}' $vg
# vgextend require vgname
invalid vgextend
# --metadatacopies => use --pvmetadatacopies
-invalid vgextend --metadatacopies 3 $vg "$dev1" |& tee out
+invalid vgextend --metadatacopies 3 $vg "$dev1" 2>&1 | tee out
grep -- "use --pvmetadatacopies" out
# VG name should exist