xref: /netbsd-src/external/gpl2/lvm2/dist/test/t-pool-labels.sh (revision 56a34939419542e88b386b2229be7565f4f45461)
1*56a34939Shaad# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
2*56a34939Shaad#
3*56a34939Shaad# This copyrighted material is made available to anyone wishing to use,
4*56a34939Shaad# modify, copy, or redistribute it subject to the terms and conditions
5*56a34939Shaad# of the GNU General Public License v.2.
6*56a34939Shaad#
7*56a34939Shaad# You should have received a copy of the GNU General Public License
8*56a34939Shaad# along with this program; if not, write to the Free Software Foundation,
9*56a34939Shaad# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10*56a34939Shaad
11*56a34939Shaad. ./test-utils.sh
12*56a34939Shaad
13*56a34939Shaad# create the old GFS pool labeled linear devices
14*56a34939Shaadcreate_pool_label_()
15*56a34939Shaad{
16*56a34939Shaad  # FIXME
17*56a34939Shaad  # echo -e is bashism, dash builtin sh doesn't do \xNN in printf either
18*56a34939Shaad  # printf comes from coreutils, and is probably not posix either
19*56a34939Shaad  env printf "\x01\x16\x70\x06\x5f\xcf\xff\xb9\xf8\x24\x8apool1" | dd of=$2 bs=5 seek=1 conv=notrunc
20*56a34939Shaad  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
21*56a34939Shaad}
22*56a34939Shaad
23*56a34939Shaadenv printf "" || exit 200 # skip if printf is not available
24*56a34939Shaad
25*56a34939Shaadaux prepare_devs 2
26*56a34939Shaad
27*56a34939Shaadcreate_pool_label_ 0 "$dev1"
28*56a34939Shaadcreate_pool_label_ 1 "$dev2"
29*56a34939Shaad
30*56a34939Shaad# check that pvcreate fails without -ff on the pool device
31*56a34939Shaadnot pvcreate "$dev1"
32*56a34939Shaad
33*56a34939Shaad# check that vgdisplay and pvcreate -ff works with the pool device
34*56a34939Shaadvgdisplay --config 'global { locking_type = 0 }'
35*56a34939Shaaddisable_dev "$dev2"
36*56a34939Shaad# FIXME! since pool1 cannot be opened, vgdisplay gives error... should we say
37*56a34939Shaad# "not" there instead, checking that it indeed does fail?
38*56a34939Shaadvgdisplay --config 'global { locking_type = 0 }' || true
39*56a34939Shaadpvcreate -ff -y "$dev1"
40