2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2016-12-23 05:35:13 +03:00
# 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
2018-05-24 17:49:48 +03:00
2016-12-23 05:35:13 +03:00
SKIP_WITH_LVMPOLLD = 1
. lib/inittest
aux have_raid 1 10 1 || skip
aux prepare_vg 6
#
# FIXME: add multi-segment leg tests
#
function _check_raid
{
local vg = $1
shift
local lv = $1
shift
local fail = $1
shift
local good = $1
shift
2017-07-08 23:29:50 +03:00
local devs = ( " $@ " )
2016-12-23 05:35:13 +03:00
aux wait_for_sync $vg $lv
2017-07-08 23:29:50 +03:00
aux disable_dev --error --silent " ${ devs [@] } "
2016-12-23 05:35:13 +03:00
mkfs.ext4 " $DM_DEV_DIR / $vg / $lv "
fsck.ext4 -fn " $DM_DEV_DIR / $vg / $lv "
check raid_leg_status $vg $lv " $fail "
2017-07-08 23:29:50 +03:00
aux enable_dev --silent " ${ devs [@] } "
2016-12-23 05:35:13 +03:00
lvs -a -o +devices $vg | tee out
not grep unknown out
lvchange --refresh $vg /$lv
fsck.ext4 -fn " $DM_DEV_DIR / $vg / $lv "
aux wait_for_sync $vg $lv
fsck.ext4 -fn " $DM_DEV_DIR / $vg / $lv "
check raid_leg_status $vg $lv " $good "
}
# raid1 with transiently failing devices
lv = 4way
lvcreate -aey --type raid1 -m 3 --ignoremonitoring -L 1 -n $lv $vg
2017-07-10 11:40:09 +03:00
_check_raid $vg $lv "ADAD" "AAAA" " $dev2 " " $dev4 "
2016-12-23 05:35:13 +03:00
lvremove -y $vg /$lv
# raid6 with transiently failing devices
lv = 6way
lvcreate -aey --type raid6 -i 4 --ignoremonitoring -L 1 -n $lv $vg
2017-07-10 11:40:09 +03:00
_check_raid $vg $lv "ADADAA" "AAAAAA" " $dev2 " " $dev4 "
2016-12-23 05:35:13 +03:00
lvremove -y $vg /$lv
# raid10 with transiently failing devices
lv = 6way
lvcreate -aey --type raid10 -i 3 -m 1 --ignoremonitoring -L 1 -n $lv $vg
2017-07-10 11:40:09 +03:00
_check_raid $vg $lv "ADADDA" "AAAAAA" " $dev2 " " $dev4 " " $dev5 "
2016-12-23 05:35:13 +03:00
lvremove -y $vg /$lv
vgremove -f $vg