Tizen 2.1 base
[external/device-mapper.git] / test / t-activate-missing.sh
1 #!/bin/bash
2
3 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
4 #
5 # This copyrighted material is made available to anyone wishing to use,
6 # modify, copy, or redistribute it subject to the terms and conditions
7 # of the GNU General Public License v.2.
8 #
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software Foundation,
11 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
12
13 # Test activation behaviour with devices missing.
14 # - snapshots and their origins are only activated together; if one fails, both
15 #   fail
16 # - partial mirrors are not activated (but maybe they should? maybe we should
17 #   instead lvconvert --repair them?)
18 # - linear LVs with bits missing are not activated
19
20 . ./test-utils.sh
21
22 prepare_vg 4
23
24 lvcreate -l1 -n linear1 $vg $dev1
25 lvcreate -l1 -n linear2 $vg $dev2
26 lvcreate -l2 -n linear12 $vg $dev1:4 $dev2:4
27
28 lvcreate -l1 -n origin1 $vg $dev1
29 lvcreate -s $vg/origin1 -l1 -n s_napshot2 $dev2
30
31 lvcreate -l1 -m1 -n mirror12 --mirrorlog core $vg $dev1 $dev2
32 lvcreate -l1 -m1 -n mirror123 $vg $dev1 $dev2 $dev3
33
34 vgchange -a n $vg
35 disable_dev $dev1
36 not vgchange -a y $vg
37 not vgck $vg
38
39 check inactive $vg linear1
40 check active $vg linear2
41 check inactive $vg origin1
42 check inactive $vg s_napshot2
43 check inactive $vg linear12
44 check inactive $vg mirror12
45 check inactive $vg mirror123
46
47 vgchange -a n $vg
48 enable_dev $dev1
49 disable_dev $dev2
50 not vgchange -a y $vg
51 not vgck $vg
52
53 check active $vg linear1
54 check inactive $vg linear2
55 check inactive $vg linear12
56 check inactive $vg origin1
57 check inactive $vg s_napshot2
58 check inactive $vg mirror12
59 check inactive $vg mirror123
60
61 vgchange -a n $vg
62 enable_dev $dev2
63 disable_dev $dev3
64 not vgchange -a y $vg
65 not vgck $vg
66
67 check active $vg origin1
68 check active $vg s_napshot2
69 check active $vg linear1
70 check active $vg linear2
71 check active $vg linear12
72 check inactive $vg mirror123
73 check active $vg mirror12
74
75 vgchange -a n $vg
76 enable_dev $dev3
77 disable_dev $dev4
78 vgchange -a y $vg
79 not vgck $vg
80
81 check active $vg origin1
82 check active $vg s_napshot2
83 check active $vg linear1
84 check active $vg linear2
85 check active $vg linear12
86 check active $vg mirror12
87 check active $vg mirror123