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_description
='Test vgmerge operation'
18 # 'vgmerge succeeds with single linear LV in source VG'
19 vgcreate
$vg1 $dev1 $dev2
20 vgcreate
$vg2 $dev3 $dev4
21 lvcreate
-l 4 -n $lv1 $vg1 $dev1
23 vg_validate_pvlv_counts_
$vg1 2 1 0
24 vg_validate_pvlv_counts_
$vg2 2 0 0
26 vg_validate_pvlv_counts_
$vg2 4 1 0
29 # 'vgmerge succeeds with single linear LV in source and destination VG'
30 vgcreate
$vg1 $dev1 $dev2
31 vgcreate
$vg2 $dev3 $dev4
32 lvcreate
-l 4 -n $lv1 $vg1
33 lvcreate
-l 4 -n $lv2 $vg2
36 vg_validate_pvlv_counts_
$vg1 2 1 0
37 vg_validate_pvlv_counts_
$vg2 2 1 0
39 vg_validate_pvlv_counts_
$vg2 4 2 0
42 # 'vgmerge succeeds with linear LV + snapshots in source VG'
43 vgcreate
$vg1 $dev1 $dev2
44 vgcreate
$vg2 $dev3 $dev4
45 lvcreate
-l 16 -n $lv1 $vg1
46 lvcreate
-l 4 -s -n $lv2 $vg1/$lv1
48 vg_validate_pvlv_counts_
$vg1 2 2 1
49 vg_validate_pvlv_counts_
$vg2 2 0 0
51 vg_validate_pvlv_counts_
$vg2 4 2 1
55 # 'vgmerge succeeds with mirrored LV in source VG'
56 vgcreate
$vg1 $dev1 $dev2 $dev3
58 lvcreate
-l 4 -n $lv1 -m1 $vg1
60 vg_validate_pvlv_counts_
$vg1 3 1 0
61 vg_validate_pvlv_counts_
$vg2 1 0 0
63 vg_validate_pvlv_counts_
$vg2 4 1 0
67 # 'vgmerge rejects LV name collision'
68 vgcreate
$vg1 $dev1 $dev2
69 vgcreate
$vg2 $dev3 $dev4
70 lvcreate
-l 4 -n $lv1 $vg1
71 lvcreate
-l 4 -n $lv1 $vg2
73 aux vg_validate_pvlv_counts_
$vg1 2 1 0
74 aux vg_validate_pvlv_counts_
$vg2 2 1 0
75 not vgmerge
$vg2 $vg1 2>err
76 grep "Duplicate logical volume name \"$lv1\" in \"$vg2\" and \"$vg1" err
77 aux vg_validate_pvlv_counts_
$vg1 2 1 0
78 aux vg_validate_pvlv_counts_
$vg2 2 1 0