1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/test/t-inconsistent-metadata.sh
Milan Broz 66086ce962 Fix double releasing of vg when repairing of vg is requested.
Several commands calls process_each_vg() and in provided
callback it explicitly recovers VG if inconsistent.
(vgchange, vgconvert, vgscan)

It means that old VG is released and reread  but the function
above (process_one_vg) tries to unlock and release old VG.

Patch moves the repair logic into _process_one_vg() function.

It always tries to read vg (even inconsistent) and then decides
what to do according new defined parameter.

Also patch unifies inconsistent error messages.

The only slight change if for vgremove command, where
it now tries to repair VG before it removes if force arg is given.
(It works similar way before, just the order of operation changed).
2009-06-05 20:00:52 +00:00

63 lines
1.6 KiB
Bash

#!/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
. ./test-utils.sh
aux prepare_vg 3
lvcreate -m 1 -l 1 -n mirror $vg
lvcreate -l 1 -n resized $vg
lvchange -a n $vg/mirror
backup_dev $devs
init() {
restore_dev $devs
lvs -o lv_name,lv_size --units k $vg | tee lvs.out
grep resized lvs.out | not grep 8192
lvresize -L 8192K $vg/resized
restore_dev $dev1
}
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
# vgdisplay doesn't change anything
init
vgdisplay 2>&1 | tee cmd.out
grep "Volume group $vg inconsistent" cmd.out
vgdisplay 2>&1 | tee cmd.out
grep "Volume group $vg inconsistent" cmd.out
# lvs fixes up
init
lvs 2>&1 | tee cmd.out
grep "Inconsistent metadata found for VG $vg - updating" cmd.out
vgdisplay 2>&1 | tee cmd.out
not grep "Volume group $vg inconsistent" cmd.out
check
# vgs doesn't fix up... (why?)
init
vgs 2>&1 | tee cmd.out
vgdisplay 2>&1 | tee cmd.out
grep "Volume group $vg inconsistent" cmd.out