2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2009-01-09 13:16:57 +03:00
# Copyright (C) 2008 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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2009-01-09 13:16:57 +03:00
2018-05-30 20:55:49 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2009-01-09 13:16:57 +03:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2011-01-28 19:13:39 +03:00
aux prepare_vg 3 12
2017-07-06 20:41:25 +03:00
get_devs
2009-01-09 13:16:57 +03:00
2013-08-08 00:48:31 +04:00
lvcreate -aye --type mirror -m 1 -l 1 -n mirror $vg
2009-01-09 13:16:57 +03:00
lvcreate -l 1 -n resized $vg
lvchange -a n $vg /mirror
2017-07-06 20:41:25 +03:00
aux backup_dev " ${ DEVICES [@] } "
2009-01-09 13:16:57 +03:00
init( ) {
2017-07-06 20:41:25 +03:00
aux restore_dev " ${ DEVICES [@] } "
2013-06-15 13:21:03 +04:00
not check lv_field $vg /resized lv_size "8.00m"
2009-01-09 13:16:57 +03:00
lvresize -L 8192K $vg /resized
2012-03-16 17:00:05 +04:00
aux restore_dev " $dev1 "
2009-01-09 13:16:57 +03:00
}
2009-06-06 00:00:52 +04:00
2009-01-09 13:16:57 +03:00
init
2018-09-10 22:26:57 +03:00
vgscan 2>& 1 | tee cmd.out
2009-01-09 13:16:57 +03:00
grep " Inconsistent metadata found for VG $vg " cmd.out
2018-09-10 22:26:57 +03:00
vgscan 2>& 1 | tee cmd.out
2009-01-09 13:16:57 +03:00
not grep " Inconsistent metadata found for VG $vg " cmd.out
2013-06-15 13:21:03 +04:00
check lv_field $vg /resized lv_size "8.00m"
2009-01-09 13:16:57 +03:00
2018-09-10 22:26:57 +03:00
# vgdisplay fixes
init
vgdisplay $vg 2>& 1 | tee cmd.out
grep " Inconsistent metadata found for VG $vg " cmd.out
vgdisplay $vg 2>& 1 | tee cmd.out
not grep " Inconsistent metadata found for VG $vg " cmd.out
check lv_field $vg /resized lv_size "8.00m"
2009-01-09 13:16:57 +03:00
2018-09-10 22:26:57 +03:00
# lvs fixes up
init
lvs $vg 2>& 1 | tee cmd.out
grep " Inconsistent metadata found for VG $vg " cmd.out
vgdisplay $vg 2>& 1 | tee cmd.out
not grep " Inconsistent metadata found for VG $vg " cmd.out
check lv_field $vg /resized lv_size "8.00m"
2009-01-09 13:16:57 +03:00
2018-09-10 22:26:57 +03:00
# vgs fixes up as well
init
vgs $vg 2>& 1 | tee cmd.out
grep " Inconsistent metadata found for VG $vg " cmd.out
vgs $vg 2>& 1 | tee cmd.out
not grep " Inconsistent metadata found for VG $vg " cmd.out
check lv_field $vg /resized lv_size "8.00m"
2010-07-07 18:43:57 +04:00
echo Check auto-repair of failed vgextend - metadata written to original pv but not new pv
vgremove -f $vg
2017-07-06 20:41:25 +03:00
pvremove -ff " ${ DEVICES [@] } "
pvcreate " ${ DEVICES [@] } "
2012-03-16 17:00:05 +04:00
aux backup_dev " $dev2 "
2018-05-30 20:55:49 +03:00
vgcreate $SHARED $vg " $dev1 "
2012-03-16 17:00:05 +04:00
vgextend $vg " $dev2 "
aux restore_dev " $dev2 "
2018-09-10 22:26:57 +03:00
vgscan
2012-03-16 17:00:05 +04:00
should check compare_fields vgs $vg vg_mda_count pvs " $dev2 " vg_mda_count
2014-02-27 02:25:30 +04:00
vgremove -ff $vg