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