1#!/bin/bash
2# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3#
4# This copyrighted material is made available to anyone wishing to use,
5# modify, copy, or redistribute it subject to the terms and conditions
6# of the GNU General Public License v.2.
7#
8# You should have received a copy of the GNU General Public License
9# along with this program; if not, write to the Free Software Foundation,
10# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
11
12. ./test-utils.sh
13
14aux prepare_vg 3
15
16lvcreate -m 1 -l 1 -n mirror $vg
17lvcreate -l 1 -n resized $vg
18lvchange -a n $vg/mirror
19
20backup_dev $devs
21
22init() {
23	restore_dev $devs
24	lvs -o lv_name,lv_size --units k $vg | tee lvs.out
25	grep resized lvs.out | not grep 8192
26	lvresize -L 8192K $vg/resized
27	restore_dev $dev1
28}
29
30check() {
31	lvs -o lv_name,lv_size --units k $vg | tee lvs.out
32	grep resized lvs.out | grep 8192
33}
34
35# vgscan fixes up metadata
36init
37vgscan 2>&1 | tee cmd.out
38grep "Inconsistent metadata found for VG $vg" cmd.out
39vgscan 2>&1 | tee cmd.out
40not grep "Inconsistent metadata found for VG $vg" cmd.out
41check
42
43# vgdisplay fixes
44init
45vgdisplay 2>&1 | tee cmd.out
46grep "Inconsistent metadata found for VG $vg" cmd.out
47vgdisplay 2>&1 | tee cmd.out
48not grep "Inconsistent metadata found for VG $vg" cmd.out
49check
50
51# lvs fixes up
52init
53lvs 2>&1 | tee cmd.out
54grep "Inconsistent metadata found for VG $vg" cmd.out
55vgdisplay 2>&1 | tee cmd.out
56not grep "Inconsistent metadata found for VG $vg" cmd.out
57check
58
59# vgs fixes up as well
60init
61vgs 2>&1 | tee cmd.out
62grep "Inconsistent metadata found for VG $vg" cmd.out
63vgs 2>&1 | tee cmd.out
64not grep "Inconsistent metadata found for VG $vg" cmd.out
65check
66