~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to test/shell/metadata.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
 
2
#
 
3
# This copyrighted material is made available to anyone wishing to use,
 
4
# modify, copy, or redistribute it subject to the terms and conditions
 
5
# of the GNU General Public License v.2.
 
6
#
 
7
# You should have received a copy of the GNU General Public License
 
8
# along with this program; if not, write to the Free Software Foundation,
 
9
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
10
 
 
11
. lib/test
 
12
 
 
13
aux prepare_devs 5
 
14
 
 
15
pvcreate $dev1
 
16
pvcreate --metadatacopies 0 $dev2
 
17
pvcreate --metadatacopies 0 $dev3
 
18
pvcreate $dev4
 
19
pvcreate --metadatacopies 0 $dev5
 
20
 
 
21
vgcreate -c n "$vg" $(cat DEVICES)
 
22
lvcreate -n $lv -l 1 -i5 -I256 $vg
 
23
 
 
24
pvchange -x n $dev1
 
25
pvchange -x y $dev1
 
26
vgchange -a n $vg
 
27
pvchange --uuid $dev1
 
28
pvchange --uuid $dev2
 
29
vgremove -f $vg
 
30
 
 
31
# check that PVs without metadata don't cause too many full device rescans (bz452606)
 
32
for mdacp in 1 0; do
 
33
        pvcreate --metadatacopies $mdacp $(cat DEVICES)
 
34
        pvcreate $dev1
 
35
        vgcreate -c n $vg $(cat DEVICES)
 
36
        lvcreate -n $lv1 -l 2 -i5 -I256 $vg
 
37
        lvcreate -n $lv2 -m2 -l 2  $vg
 
38
        #lvchange -an $vg
 
39
        lvchange -an $vg/$lv1
 
40
        lvchange -an $vg/$lv2
 
41
        vgchange -ay $vg
 
42
        lvchange -vvvv -an $vg/$lv1 >out$mdacp 2>&1 
 
43
        lvchange -vvvv -an $vg/$lv2 >>out$mdacp 2>&1 
 
44
        vgremove -f $vg
 
45
done
 
46
not grep "Cached VG .* incorrect PV list" out0
 
47
 
 
48
# some M1 metadata tests
 
49
pvcreate -M1 $dev1
 
50
pvcreate -M1 $dev2
 
51
pvcreate -M1 $dev3
 
52
pv3_uuid=$(pvs --noheadings -o pv_uuid $dev3)
 
53
vgcreate -M1 -c n $vg $dev1 $dev2 $dev3
 
54
pvchange --uuid $dev1
 
55
 
 
56
# verify pe_start of all M1 PVs
 
57
pv_align="128.00k"
 
58
check pv_field $dev1 pe_start $pv_align
 
59
check pv_field $dev2 pe_start $pv_align
 
60
check pv_field $dev3 pe_start $pv_align
 
61
 
 
62
pvs --units k -o name,pe_start,vg_mda_size,vg_name
 
63
 
 
64
# upgrade from v1 to v2 metadata
 
65
vgconvert -M2 $vg
 
66
 
 
67
# verify pe_start of all M2 PVs
 
68
check pv_field $dev1 pe_start $pv_align
 
69
check pv_field $dev2 pe_start $pv_align
 
70
check pv_field $dev3 pe_start $pv_align
 
71
 
 
72
pvs --units k -o name,pe_start,vg_mda_size,vg_name
 
73
 
 
74
# create backup and then restore $dev3
 
75
vgcfgbackup -f $TESTDIR/bak-%s $vg
 
76
pvcreate -ff -y --restorefile $TESTDIR/bak-$vg --uuid $pv3_uuid $dev3
 
77
vgcfgrestore -f $TESTDIR/bak-$vg $vg
 
78
 
 
79
# verify pe_start of $dev3
 
80
check pv_field $dev3 pe_start $pv_align