2 # Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved.
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions
6 # of the GNU General Public License v.2.
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software Foundation,
10 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 # Test vgsplit command options for validity
21 pvcreate
-M$mdatype $devs
23 # ensure name order does not matter
24 # NOTE: if we're using lvm1, we must use -M on vgsplit
25 vgcreate
-M$mdatype $vg1 $devs
26 vgsplit
-M$mdatype $vg1 $vg2 $dev1
29 vgcreate
-M$mdatype $vg2 $devs
30 vgsplit
-M$mdatype $vg2 $vg1 $dev1
34 # vgsplit accepts new vg as destination of split
36 vgcreate
-M$mdatype $vg1 $devs
37 vgsplit
$vg1 $vg2 $dev1 1>err
38 grep "New volume group \"$vg2\" successfully split from \"$vg1\"" err
42 # vgsplit accepts existing vg as destination of split
43 vgcreate
-M$mdatype $vg1 $dev1 $dev2
44 vgcreate
-M$mdatype $vg2 $dev3 $dev4
45 vgsplit
$vg1 $vg2 $dev1 1>err
46 grep "Existing volume group \"$vg2\" successfully split from \"$vg1\"" err
50 # vgsplit accepts --maxphysicalvolumes 128 on new VG
51 vgcreate
-M$mdatype $vg1 $dev1 $dev2
52 vgsplit
--maxphysicalvolumes 128 $vg1 $vg2 $dev1
53 check_vg_field_
$vg2 max_pv
128
57 # vgsplit accepts --maxlogicalvolumes 128 on new VG
58 vgcreate
-M$mdatype $vg1 $dev1 $dev2
59 vgsplit
--maxlogicalvolumes 128 $vg1 $vg2 $dev1
60 check_vg_field_
$vg2 max_lv
128
64 # vgsplit rejects split because max_pv of destination would be exceeded
65 vgcreate
-M$mdatype --maxphysicalvolumes 2 $vg1 $dev1 $dev2
66 vgcreate
-M$mdatype --maxphysicalvolumes 2 $vg2 $dev3 $dev4
67 not vgsplit
$vg1 $vg2 $dev1 2>err
;
68 grep "^ Maximum number of physical volumes (2) exceeded" err
72 # vgsplit rejects split because maxphysicalvolumes given with existing vg
73 vgcreate
-M$mdatype --maxphysicalvolumes 2 $vg1 $dev1 $dev2
74 vgcreate
-M$mdatype --maxphysicalvolumes 2 $vg2 $dev3 $dev4
75 not vgsplit
--maxphysicalvolumes 2 $vg1 $vg2 $dev1 2>err
;
76 grep "^ Volume group \"$vg2\" exists, but new VG option specified" err
80 # vgsplit rejects split because maxlogicalvolumes given with existing vg
81 vgcreate
-M$mdatype --maxlogicalvolumes 2 $vg1 $dev1 $dev2
82 vgcreate
-M$mdatype --maxlogicalvolumes 2 $vg2 $dev3 $dev4
83 not vgsplit
--maxlogicalvolumes 2 $vg1 $vg2 $dev1 2>err
84 grep "^ Volume group \"$vg2\" exists, but new VG option specified" err
88 # vgsplit rejects split because alloc given with existing vg
89 vgcreate
-M$mdatype --alloc cling
$vg1 $dev1 $dev2
90 vgcreate
-M$mdatype --alloc cling
$vg2 $dev3 $dev4
91 not vgsplit
--alloc cling
$vg1 $vg2 $dev1 2>err
;
92 grep "^ Volume group \"$vg2\" exists, but new VG option specified" err
96 # vgsplit rejects split because clustered given with existing vg
97 vgcreate
-M$mdatype --clustered n
$vg1 $dev1 $dev2
98 vgcreate
-M$mdatype --clustered n
$vg2 $dev3 $dev4
99 not vgsplit
--clustered n
$vg1 $vg2 $dev1 2>err
100 grep "^ Volume group \"$vg2\" exists, but new VG option specified" err
104 # vgsplit rejects vg with active lv
105 pvcreate
-M$mdatype -ff $dev3 $dev4
106 vgcreate
-M$mdatype $vg1 $dev1 $dev2
107 vgcreate
-M$mdatype $vg2 $dev3 $dev4
108 lvcreate
-l 4 -n $lv1 $vg1
109 not vgsplit
$vg1 $vg2 $dev1 2>err
;
110 grep "^ Logical volumes in \"$vg1\" must be inactive\$" err
114 # vgsplit rejects split because max_lv is exceeded
115 vgcreate
-M$mdatype --maxlogicalvolumes 2 $vg1 $dev1 $dev2
116 vgcreate
-M$mdatype --maxlogicalvolumes 2 $vg2 $dev3 $dev4
117 lvcreate
-l 4 -n $lv1 $vg1
118 lvcreate
-l 4 -n $lv2 $vg1
119 lvcreate
-l 4 -n $lv3 $vg2
122 not vgsplit
$vg1 $vg2 $dev1 2>err
;
123 grep "^ Maximum number of logical volumes (2) exceeded" err
127 # vgsplit verify default - max_lv attribute from new VG is same as source VG" \
128 vgcreate
-M$mdatype $vg1 $dev1 $dev2
129 lvcreate
-l 4 -n $lv1 $vg1
131 vgsplit
$vg1 $vg2 $dev1
132 compare_vg_field_
$vg1 $vg2 max_lv
136 # vgsplit verify default - max_pv attribute from new VG is same as source VG" \
137 vgcreate
-M$mdatype $vg1 $dev1 $dev2
138 lvcreate
-l 4 -n $lv1 $vg1
140 vgsplit
$vg1 $vg2 $dev1
141 compare_vg_field_
$vg1 $vg2 max_pv
145 # vgsplit verify default - vg_fmt attribute from new VG is same as source VG" \
146 vgcreate
-M$mdatype $vg1 $dev1 $dev2
147 lvcreate
-l 4 -n $lv1 $vg1
149 vgsplit
$vg1 $vg2 $dev1
150 compare_vg_field_
$vg1 $vg2 vg_fmt
154 # vgsplit rejects split because PV not in VG
155 vgcreate
-M$mdatype $vg1 $dev1 $dev2
156 vgcreate
-M$mdatype $vg2 $dev3 $dev4
157 lvcreate
-l 4 -n $lv1 $vg1
158 lvcreate
-l 4 -n $lv2 $vg1
160 not vgsplit
$vg1 $vg2 $dev3 2>err
;
167 pvcreate
--metadatacopies 0 $dev5
169 # vgsplit rejects to give away pv with the last mda copy
170 vgcreate
$vg1 $dev5 $dev2
171 lvcreate
-l 10 -n $lv1 $vg1
172 lvchange
-an $vg1/$lv1
173 vg_validate_pvlv_counts_
$vg1 2 1 0
174 not vgsplit
$vg1 $vg2 $dev5;
175 vg_validate_pvlv_counts_
$vg1 2 1 0
178 # vgsplit rejects split because metadata types differ
179 pvcreate
-ff -M1 $dev3 $dev4
180 pvcreate
-ff $dev1 $dev2
181 vgcreate
-M1 $vg1 $dev3 $dev4
182 vgcreate
$vg2 $dev1 $dev2
183 not vgsplit
$vg1 $vg2 $dev3 2>err
;
184 grep "^ Metadata types differ" err