2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2014-04-26 01:59:09 +04:00
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2014-04-26 01:59:09 +04:00
# Test vgsplit operation, including different LV types
2016-02-23 01:13:42 +03:00
SKIP_WITH_LVMLOCKD = 1
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2014-04-26 01:59:09 +04:00
2014-06-06 19:40:04 +04:00
. lib/inittest
2014-04-26 01:59:09 +04:00
COMM( ) {
2017-07-07 13:12:24 +03:00
LAST_TEST = " $* "
2014-04-26 01:59:09 +04:00
}
create_vg_( ) {
vgcreate -s 64k " $@ "
}
2014-05-24 00:35:05 +04:00
aux have_raid 1 3 0 || skip
2014-04-26 01:59:09 +04:00
aux prepare_pvs 5 10
#
# vgsplit can be done into a new or existing VG
#
for i in new existing
do
#
# We can have PVs or LVs on the cmdline
#
for j in PV LV
do
COMM " vgsplit correctly splits RAID LV into $i VG ( $j args) "
create_vg_ $vg1 " $dev1 " " $dev2 " " $dev3 "
test $i = existing && create_vg_ $vg2 " $dev5 "
lvcreate -an -Zn -l 64 --type raid5 -i 2 -n $lv1 $vg1
if [ $j = PV ] ; then
not vgsplit $vg1 $vg2 " $dev1 "
not vgsplit $vg1 $vg2 " $dev2 "
not vgsplit $vg1 $vg2 " $dev1 " " $dev2 "
vgsplit $vg1 $vg2 " $dev1 " " $dev2 " " $dev3 "
else
vgsplit -n $lv1 $vg1 $vg2
fi
if [ $i = existing ] ; then
check pvlv_counts $vg2 4 1 0
else
check pvlv_counts $vg2 3 1 0
fi
vgremove -f $vg2
done
done