2009-01-09 13:16:57 +03:00
#!/bin/bash
# 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,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2011-01-05 03:16:18 +03:00
. lib/test
2009-01-09 13:16:57 +03:00
2011-01-28 19:13:39 +03:00
aux prepare_vg 3 12
2009-01-09 13:16:57 +03:00
lvcreate -m 1 -l 1 -n mirror $vg
lvcreate -l 1 -n resized $vg
lvchange -a n $vg /mirror
2011-01-05 03:16:18 +03:00
aux backup_dev $( cat DEVICES)
2009-01-09 13:16:57 +03:00
init( ) {
2011-01-05 03:16:18 +03:00
aux restore_dev $( cat DEVICES)
2009-01-09 13:16:57 +03:00
lvs -o lv_name,lv_size --units k $vg | tee lvs.out
grep resized lvs.out | not grep 8192
lvresize -L 8192K $vg /resized
2011-01-05 03:16:18 +03: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
check( ) {
lvs -o lv_name,lv_size --units k $vg | tee lvs.out
grep resized lvs.out | grep 8192
}
# vgscan fixes up metadata
init
vgscan 2>& 1 | tee cmd.out
grep " Inconsistent metadata found for VG $vg " cmd.out
vgscan 2>& 1 | tee cmd.out
not grep " Inconsistent metadata found for VG $vg " cmd.out
check
2009-07-01 21:06:04 +04:00
# vgdisplay fixes
2009-01-09 13:16:57 +03:00
init
vgdisplay 2>& 1 | tee cmd.out
2009-07-01 21:06:04 +04:00
grep " Inconsistent metadata found for VG $vg " cmd.out
2009-01-09 13:16:57 +03:00
vgdisplay 2>& 1 | tee cmd.out
2009-07-01 21:06:04 +04:00
not grep " Inconsistent metadata found for VG $vg " cmd.out
check
2009-01-09 13:16:57 +03:00
# lvs fixes up
init
lvs 2>& 1 | tee cmd.out
2009-07-01 21:06:04 +04:00
grep " Inconsistent metadata found for VG $vg " cmd.out
2009-01-09 13:16:57 +03:00
vgdisplay 2>& 1 | tee cmd.out
2009-07-01 21:06:04 +04:00
not grep " Inconsistent metadata found for VG $vg " cmd.out
2009-01-09 13:16:57 +03:00
check
2009-07-01 21:06:04 +04:00
# vgs fixes up as well
2009-01-09 13:16:57 +03:00
init
vgs 2>& 1 | tee cmd.out
2009-07-01 21:06:04 +04:00
grep " Inconsistent metadata found for VG $vg " cmd.out
vgs 2>& 1 | tee cmd.out
not grep " Inconsistent metadata found for VG $vg " cmd.out
check
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
2011-01-05 03:16:18 +03:00
pvremove -ff $( cat DEVICES)
pvcreate $( cat DEVICES)
aux backup_dev $dev2
2010-07-07 18:43:57 +04:00
vgcreate $vg $dev1
vgextend $vg $dev2
2011-01-05 03:16:18 +03:00
aux restore_dev $dev2
should check compare_fields vgs $vg vg_mda_count pvs $dev2 vg_mda_count