mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
tests: verify repair of failing mirror
Improved test script to verify lost mirror image does not cause mirror corruption while mirror is in use. TODO: add more cases (lost mlog...), lost image from 3leg mirror...
This commit is contained in:
parent
9be7bca4be
commit
07c25429e2
75
test/shell/lvconvert-repair-mirror.sh
Normal file
75
test/shell/lvconvert-repair-mirror.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
SKIP_WITH_LVMLOCKD=1
|
||||
SKIP_WITH_LVMPOLLD=1
|
||||
|
||||
MOUNT_DIR=mnt
|
||||
|
||||
. lib/inittest
|
||||
|
||||
cleanup_mounted_and_teardown()
|
||||
{
|
||||
umount "$MOUNT_DIR" || true
|
||||
aux teardown
|
||||
}
|
||||
|
||||
aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1'
|
||||
|
||||
aux prepare_vg 5
|
||||
|
||||
################### Check lost mirror leg #################
|
||||
#
|
||||
# NOTE: using --regionsize 1M has major impact on my box
|
||||
# on read performance while mirror is synchronized
|
||||
# with the default 512K - my C2D T61 reads just couple MB/s!
|
||||
#
|
||||
lvcreate -aey --type mirror -L10 --regionsize 1M -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
|
||||
mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
|
||||
mkdir "$MOUNT_DIR"
|
||||
|
||||
aux delay_dev "$dev2" 0 500 $(get first_extent_sector "$dev2"):
|
||||
aux delay_dev "$dev4" 0 500 $(get first_extent_sector "$dev4"):
|
||||
#
|
||||
# Enforce syncronization
|
||||
# ATM requires unmounted/unused LV??
|
||||
#
|
||||
lvchange --yes --resync --noudevsync $vg/$lv1
|
||||
trap 'cleanup_mounted_and_teardown' EXIT
|
||||
mount "$DM_DEV_DIR/$vg/$lv1" "$MOUNT_DIR"
|
||||
|
||||
# run 'dd' operation during failure of 'mlog/mimage' device
|
||||
|
||||
dd if=/dev/zero of=mnt/zero bs=4K count=100 conv=fdatasync 2>err &
|
||||
|
||||
PERCENT=$(get lv_field $vg/$lv1 copy_percent)
|
||||
PERCENT=${PERCENT%%\.*} # cut decimal
|
||||
test "$PERCENT" -lt 50 # and check less then 50% mirror is in sync
|
||||
#lvs -a -o+devices $vg
|
||||
|
||||
#aux disable_dev "$dev3"
|
||||
aux disable_dev "$dev2"
|
||||
|
||||
lvconvert --yes --repair $vg/$lv1
|
||||
lvs -a $vg
|
||||
|
||||
aux enable_dev "$dev2"
|
||||
|
||||
wait
|
||||
# dd MAY NOT HAVE produced any error message
|
||||
not grep error err
|
||||
|
||||
lvs -a -o+devices $vg
|
||||
umount "$MOUNT_DIR"
|
||||
fsck -n "$DM_DEV_DIR/$vg/$lv1"
|
||||
|
||||
aux enable_dev "$dev4"
|
||||
lvremove -ff $vg
|
Loading…
x
Reference in New Issue
Block a user