xref: /dflybsd-src/contrib/lvm2/dist/test/t-pool-labels.sh (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
286d7f5d3SJohn Marino#
386d7f5d3SJohn Marino# This copyrighted material is made available to anyone wishing to use,
486d7f5d3SJohn Marino# modify, copy, or redistribute it subject to the terms and conditions
586d7f5d3SJohn Marino# of the GNU General Public License v.2.
686d7f5d3SJohn Marino#
786d7f5d3SJohn Marino# You should have received a copy of the GNU General Public License
886d7f5d3SJohn Marino# along with this program; if not, write to the Free Software Foundation,
986d7f5d3SJohn Marino# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1086d7f5d3SJohn Marino
1186d7f5d3SJohn Marino. ./test-utils.sh
1286d7f5d3SJohn Marino
1386d7f5d3SJohn Marino# create the old GFS pool labeled linear devices
1486d7f5d3SJohn Marinocreate_pool_label_()
1586d7f5d3SJohn Marino{
1686d7f5d3SJohn Marino  # FIXME
1786d7f5d3SJohn Marino  # echo -e is bashism, dash builtin sh doesn't do \xNN in printf either
1886d7f5d3SJohn Marino  # printf comes from coreutils, and is probably not posix either
1986d7f5d3SJohn Marino  env printf "\x01\x16\x70\x06\x5f\xcf\xff\xb9\xf8\x24\x8apool1" | dd of=$2 bs=5 seek=1 conv=notrunc
2086d7f5d3SJohn Marino  env printf "\x04\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x0$1\x68\x01\x16\x70\x00\x00\x00\x00\x00\x06\x5f\xd0" | dd of=$2 bs=273 seek=1 conv=notrunc
2186d7f5d3SJohn Marino}
2286d7f5d3SJohn Marino
2386d7f5d3SJohn Marinoenv printf "" || exit 200 # skip if printf is not available
2486d7f5d3SJohn Marino
2586d7f5d3SJohn Marinoaux prepare_devs 2
2686d7f5d3SJohn Marino
2786d7f5d3SJohn Marinocreate_pool_label_ 0 "$dev1"
2886d7f5d3SJohn Marinocreate_pool_label_ 1 "$dev2"
2986d7f5d3SJohn Marino
3086d7f5d3SJohn Marino# check that pvcreate fails without -ff on the pool device
3186d7f5d3SJohn Marinonot pvcreate "$dev1"
3286d7f5d3SJohn Marino
3386d7f5d3SJohn Marino# check that vgdisplay and pvcreate -ff works with the pool device
3486d7f5d3SJohn Marinovgdisplay --config 'global { locking_type = 0 }'
3586d7f5d3SJohn Marinodisable_dev "$dev2"
3686d7f5d3SJohn Marino# FIXME! since pool1 cannot be opened, vgdisplay gives error... should we say
3786d7f5d3SJohn Marino# "not" there instead, checking that it indeed does fail?
3886d7f5d3SJohn Marinovgdisplay --config 'global { locking_type = 0 }' || true
3986d7f5d3SJohn Marinopvcreate -ff -y "$dev1"
40