~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to test/shell/vgsplit-raid.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2014-08-19 15:37:06 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20140819153706-i1gaio8lg534dara
Tags: 2.02.109-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
 
3
#
 
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.
 
7
#
 
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
 
11
 
 
12
# Test vgsplit operation, including different LV types
 
13
 
 
14
. lib/inittest
 
15
 
 
16
COMM() {
 
17
        LAST_TEST="$@"
 
18
}
 
19
 
 
20
create_vg_() {
 
21
        vgcreate -s 64k "$@"
 
22
}
 
23
 
 
24
aux have_raid 1 3 0 || skip
 
25
 
 
26
aux prepare_pvs 5 10
 
27
 
 
28
#
 
29
# vgsplit can be done into a new or existing VG
 
30
#
 
31
for i in new existing
 
32
do
 
33
        #
 
34
        # We can have PVs or LVs on the cmdline
 
35
        #
 
36
        for j in PV LV
 
37
        do
 
38
COMM "vgsplit correctly splits RAID LV into $i VG ($j args)"
 
39
                create_vg_ $vg1 "$dev1" "$dev2" "$dev3"
 
40
                test $i = existing && create_vg_ $vg2 "$dev5"
 
41
 
 
42
                lvcreate -an -Zn -l 64 --type raid5 -i 2 -n $lv1 $vg1
 
43
                if [ $j = PV ]; then
 
44
                  not vgsplit $vg1 $vg2 "$dev1"
 
45
                  not vgsplit $vg1 $vg2 "$dev2"
 
46
                  not vgsplit $vg1 $vg2 "$dev1" "$dev2"
 
47
                  vgsplit $vg1 $vg2 "$dev1" "$dev2" "$dev3"
 
48
                else
 
49
                  vgsplit -n $lv1 $vg1 $vg2
 
50
                fi
 
51
                if [ $i = existing ]; then
 
52
                  check pvlv_counts $vg2 4 1 0
 
53
                else
 
54
                  check pvlv_counts $vg2 3 1 0
 
55
                fi
 
56
                vgremove -f $vg2
 
57
        done
 
58
done