2021-01-26 21:32:24 +03:00
#!/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
2021-02-01 22:10:07 +03:00
aux have_raid 1 7 0 || skip
2021-02-01 17:01:04 +03:00
2021-01-26 21:32:24 +03:00
aux prepare_vg 6
2024-08-30 13:10:35 +03:00
# raid0 losing a leg
2021-01-26 21:32:24 +03:00
lvcreate -aey --type raid0 -i5 -l5 -n $lv $vg
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *NOT available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvremove -y $vg /$lv
2024-08-30 13:10:35 +03:00
# raid1 losing a leg/all legs
2021-03-28 03:09:42 +03:00
lvcreate -aey --type raid1 -m1 -l5 -n $lv $vg " $dev1 " " $dev2 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev2 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *NOT available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 " " $dev2 "
2021-01-26 21:32:24 +03:00
lvremove -y $vg /$lv
2024-08-30 13:10:35 +03:00
# raid5 losing a leg/2 legs
2021-01-26 21:32:24 +03:00
lvcreate -aey --type raid5 -i3 -l5 -n $lv $vg
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev2 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *NOT available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 " " $dev2 "
2021-01-26 21:32:24 +03:00
lvremove -y $vg /$lv
2024-08-30 13:10:35 +03:00
# raid6 losing a leg/2 legs/3 legs
2021-01-26 21:32:24 +03:00
lvcreate -aey --type raid6 -i3 -l5 -n $lv $vg
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev2 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev3 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *NOT available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 " " $dev2 " " $dev3 "
2021-01-26 21:32:24 +03:00
lvremove -y $vg /$lv
2024-08-30 13:10:35 +03:00
# raid10 losing a leg per mirror group / a complete mirror group
2021-01-26 21:32:24 +03:00
lvcreate -aey --type raid10 -i3 -l3 -n $lv $vg
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev3 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev6 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 " " $dev3 " " $dev6 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *available"
2021-03-28 03:09:42 +03:00
aux disable_dev " $dev1 " " $dev2 "
2021-01-26 21:32:24 +03:00
lvdisplay $vg /$lv | grep "LV Status *NOT available (partial)"
2021-03-28 03:09:42 +03:00
aux enable_dev " $dev1 " " $dev2 "
2021-01-26 21:32:24 +03:00
vgremove -y -f $vg