mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
f08ef23856
In case legs of a raid0 LV are removed, the lvdisplay command still reports 'available' though raid0 is not providing any resilience compared to the other raid levels. Also lvdisplay does not display '(partial)' in case of missing raid0 legs as oposed to the lvs command. Enhance lvdisplay to report "NOT available" for any RaidLV type in case too many legs are inaccessible hence causing data loss. I.e. any leg for raid0, all for raid1, more than 1 for raid4/5, more than 2 for raid6 and in case of completely lost mirror groups for raid10. Add test/shell/lvdisplay-raid.sh. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1872678
80 lines
2.5 KiB
Bash
80 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (C) 2021 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
|
|
|
|
#
|
|
# tests functionality lvdisplay tool for RAID
|
|
#
|
|
|
|
SKIP_WITH_LVMPOLLD=1
|
|
|
|
. lib/inittest
|
|
|
|
aux prepare_vg 6
|
|
get_devs
|
|
|
|
# raid0 loosing a leg
|
|
lvcreate -aey --type raid0 -i5 -l5 -n $lv $vg
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1
|
|
lvdisplay $vg/$lv|grep "LV Status *NOT available (partial)"
|
|
aux enable_dev $dev1
|
|
lvremove -y $vg/$lv
|
|
|
|
# raid1 loosing a leg/all legs
|
|
lvcreate -aey --type raid1 -m1 -l5 -n $lv $vg $dev1 $dev2
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev2
|
|
lvdisplay $vg/$lv|grep "LV Status *NOT available (partial)"
|
|
aux enable_dev $dev1 $dev2
|
|
lvremove -y $vg/$lv
|
|
|
|
# raid5 loosing a leg/2 legs
|
|
lvcreate -aey --type raid5 -i3 -l5 -n $lv $vg
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev2
|
|
lvdisplay $vg/$lv|grep "LV Status *NOT available (partial)"
|
|
aux enable_dev $dev1 $dev2
|
|
lvremove -y $vg/$lv
|
|
|
|
# raid6 loosing a leg/2 legs/3 legs
|
|
lvcreate -aey --type raid6 -i3 -l5 -n $lv $vg
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev2
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev3
|
|
lvdisplay $vg/$lv|grep "LV Status *NOT available (partial)"
|
|
aux enable_dev $dev1 $dev2 $dev3
|
|
lvremove -y $vg/$lv
|
|
|
|
# raid10 loosing a leg per mirror group / a complete mirror group
|
|
lvcreate -aey --type raid10 -i3 -l3 -n $lv $vg
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev3
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux disable_dev $dev6
|
|
lvdisplay $vg/$lv|grep "LV Status *available (partial)"
|
|
aux enable_dev $dev1 $dev3 $dev6
|
|
lvdisplay $vg/$lv|grep "LV Status *available"
|
|
aux disable_dev $dev1 $dev2
|
|
lvdisplay $vg/$lv|grep "LV Status *NOT available (partial)"
|
|
aux enable_dev $dev1 $dev2
|
|
|
|
vgremove -y -f $vg
|