2013-08-27 01:38:54 +04:00
#!/bin/sh
# Copyright (C) 2013 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
2013-08-27 01:38:54 +04:00
2013-09-16 13:18:31 +04:00
test_description = "ensure pvmove works with all common segment types"
2013-08-27 01:38:54 +04:00
2016-02-23 01:13:42 +03:00
SKIP_WITH_LVMLOCKD = 1
2014-06-06 19:40:04 +04:00
. lib/inittest
2013-08-27 01:38:54 +04:00
which md5sum || skip
2013-09-16 13:18:31 +04:00
aux prepare_pvs 5 20
2014-02-15 23:40:42 +04:00
vgcreate -s 256k $vg $( cat DEVICES)
2013-08-27 01:38:54 +04:00
# Each of the following tests does:
# 1) Create two LVs - one linear and one other segment type
# The two LVs will share a PV.
# 2) Move both LVs together
# 3) Move only the second LV by name
2013-09-16 13:18:31 +04:00
# Testing pvmove of linear LV
2014-02-15 23:40:42 +04:00
lvcreate -aey -l 2 -n ${ lv1 } _foo $vg " $dev1 "
lvcreate -aey -l 2 -n $lv1 $vg " $dev1 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev1 "
check lv_tree_on $vg $lv1 " $dev1 "
aux mkdev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove " $dev1 " " $dev5 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check lv_tree_on $vg $lv1 " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove -n $lv1 " $dev5 " " $dev4 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg $lv1 " $dev4 "
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
lvremove -ff $vg
2013-09-16 13:18:31 +04:00
# Testing pvmove of stripe LV
2014-02-15 23:40:42 +04:00
lvcreate -aey -l 2 -n ${ lv1 } _foo $vg " $dev1 "
lvcreate -aey -l 4 -i 2 -n $lv1 $vg " $dev1 " " $dev2 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev1 "
check lv_tree_on $vg $lv1 " $dev1 " " $dev2 "
aux mkdev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove " $dev1 " " $dev5 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check lv_tree_on $vg $lv1 " $dev2 " " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove -n $lv1 " $dev5 " " $dev4 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg $lv1 " $dev2 " " $dev4 "
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
lvremove -ff $vg
2014-02-15 23:40:42 +04:00
if test -e LOCAL_CLVMD ; then
#FIXME these tests currently fail end require cmirrord
2015-04-02 13:37:56 +03:00
echo " $( should false ) FIXME!!! pvmove in clustered VG not fully supported! "
2014-02-15 23:40:42 +04:00
else
2013-09-16 13:18:31 +04:00
# Testing pvmove of mirror LV
2014-02-15 23:40:42 +04:00
lvcreate -aey -l 2 -n ${ lv1 } _foo $vg " $dev1 "
lvcreate -aey -l 2 --type mirror -m 1 -n $lv1 $vg " $dev1 " " $dev2 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev1 "
check lv_tree_on $vg $lv1 " $dev1 " " $dev2 "
aux mkdev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove " $dev1 " " $dev5 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check lv_tree_on $vg $lv1 " $dev2 " " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
pvmove -n $lv1 " $dev5 " " $dev4 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg $lv1 " $dev2 " " $dev4 "
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check dev_md5sum $vg $lv1
2013-08-27 01:38:54 +04:00
lvremove -ff $vg
# Dummy LV and snap share dev1, while origin is on dev2
2013-09-16 13:18:31 +04:00
# Testing pvmove of snapshot LV
2014-02-15 23:40:42 +04:00
lvcreate -aey -l 2 -n ${ lv1 } _foo $vg " $dev1 "
lvcreate -aey -l 2 -n $lv1 $vg " $dev2 "
2013-08-27 01:38:54 +04:00
lvcreate -s $vg /$lv1 -l 2 -n snap " $dev1 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev1 "
check lv_tree_on $vg snap " $dev1 "
aux mkdev_md5sum $vg snap
2013-08-27 01:38:54 +04:00
pvmove " $dev1 " " $dev5 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check lv_tree_on $vg snap " $dev5 "
check dev_md5sum $vg snap
2013-08-27 01:38:54 +04:00
pvmove -n snap " $dev5 " " $dev4 "
2013-09-16 13:18:31 +04:00
check lv_tree_on $vg snap " $dev4 "
check lv_tree_on $vg ${ lv1 } _foo " $dev5 "
check dev_md5sum $vg snap
2013-08-27 01:38:54 +04:00
lvremove -ff $vg
2014-02-15 23:40:42 +04:00
fi
2014-02-27 02:25:30 +04:00
vgremove -ff $vg