mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-25 01:34:38 +03:00
aa3bdb1911
1) Test that the primary mirror image cannot be removed while the mirror set is sync'ing. 2) Test that you cannot start a second mirror up-convert while one is already in progress. The trouble is that if the sync/conversion finishes before the tests occur, the tests will fail by why of success where there should have been failure. This means the sync/conversion must happen very quickly, but this is possible because the test mirrors we are creating are so small. In order to decrease the likelyhood of these test failing (or more correctly, failing to test the right thing), I've increase the size of the mirrors. It will still be remotely possible that the tests will fail (by way of failing to test the right thing). If this continues to happen, more involved mechanisms will need to be put in place. (Perhaps these will still be created, but this change should be a remedy until that time.)
81 lines
2.6 KiB
Bash
81 lines
2.6 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) 2010 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,
|
|
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
. ./test-utils.sh
|
|
aux prepare_vg 5 200
|
|
|
|
# convert from linear to 2-way mirror
|
|
lvcreate -l2 -n $lv1 $vg $dev1
|
|
lvconvert -i1 -m+1 $vg/$lv1 $dev2 $dev3:0-1
|
|
check mirror $vg $lv1 $dev3
|
|
lvremove -ff $vg
|
|
|
|
# convert from 2-way mirror to linear
|
|
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
|
lvconvert -m-1 $vg/$lv1
|
|
check linear $vg $lv1
|
|
lvremove -ff $vg
|
|
# and now try removing a specific leg (bz453643)
|
|
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
|
lvconvert -m0 $vg/$lv1 $dev2
|
|
check lv_on $vg/$lv1 $dev1
|
|
lvremove -ff $vg
|
|
|
|
# convert from disklog to corelog, active
|
|
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
|
lvconvert -f --mirrorlog core $vg/$lv1
|
|
check mirror $vg $lv1 ""
|
|
lvremove -ff $vg
|
|
|
|
# convert from corelog to disklog, active
|
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
|
lvconvert --mirrorlog disk $vg/$lv1 $dev3:0-1
|
|
check mirror $vg $lv1 $dev3
|
|
lvremove -ff $vg
|
|
|
|
# bz192865: lvconvert log of an inactive mirror lv
|
|
# convert from disklog to corelog, inactive
|
|
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
|
lvchange -an $vg/$lv1
|
|
echo y | lvconvert -f --mirrorlog core $vg/$lv1
|
|
check mirror $vg $lv1 ""
|
|
lvremove -ff $vg
|
|
|
|
# convert from corelog to disklog, inactive
|
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
|
lvchange -an $vg/$lv1
|
|
lvconvert --mirrorlog disk $vg/$lv1 $dev3:0-1
|
|
check mirror $vg $lv1 $dev3
|
|
lvremove -ff $vg
|
|
|
|
# convert linear to 2-way mirror with 1 PV
|
|
lvcreate -l2 -n $lv1 $vg $dev1
|
|
not lvconvert -m+1 --mirrorlog core $vg/$lv1 $dev1
|
|
lvremove -ff $vg
|
|
|
|
# Start w/ 3-way mirror
|
|
# Test pulling primary image before mirror in-sync (should fail)
|
|
# Test pulling primary image after mirror in-sync (should work)
|
|
# Test that the correct devices remain in the mirror
|
|
lvcreate -l20 -m2 -n $lv1 $vg $dev1 $dev2 $dev4 $dev3:0
|
|
# FIXME:
|
|
# This is somewhat timing dependent - sync /could/ finish before
|
|
# we get a chance to have this command fail
|
|
not lvconvert -m-1 $vg/$lv1 $dev1
|
|
while [ `lvs --noheadings -o copy_percent $vg/$lv1` != "100.00" ]; do
|
|
sleep 1
|
|
done
|
|
lvconvert -m-1 $vg/$lv1 $dev1
|
|
check mirror_images_on $lv1 $dev2 $dev4
|
|
lvconvert -m-1 $vg/$lv1 $dev2
|
|
check linear $vg $lv1
|
|
check lv_on $vg/$lv1 $dev4
|