1#!/bin/sh
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
12test_description='Exercise some vgchange diagnostics'
13
14. ./test-utils.sh
15
16aux prepare_pvs 3
17pvcreate --metadatacopies 0 $dev1
18vgcreate $vg $devs
19
20get_vg_field() {
21	local vg=$1
22	local field=$2
23	local value
24	vgs --noheading -o $field $vg | sed 's/^ *//'
25}
26
27vgdisplay $vg
28
29# vgchange -p MaxPhysicalVolumes (bz202232)
30aux check_vg_field_ $vg max_pv 0
31vgchange -p 128 $vg
32aux check_vg_field_ $vg max_pv 128
33
34pv_count=$(get_vg_field $vg pv_count)
35not vgchange -p 2 $vg 2>err
36grep "MaxPhysicalVolumes is less than the current number $pv_count of PVs for" err
37aux check_vg_field_ $vg max_pv 128
38
39# vgchange -l MaxLogicalVolumes
40aux check_vg_field_ $vg max_lv 0
41vgchange -l 128 $vg
42aux check_vg_field_ $vg max_lv 128
43
44lvcreate -l4 -n$lv1 $vg
45lvcreate -l4 -n$lv2 $vg
46
47lv_count=$(get_vg_field $vg lv_count)
48not vgchange -l 1 $vg 2>err
49grep "MaxLogicalVolume is less than the current number $lv_count of LVs for"  err
50aux check_vg_field_ $vg max_lv 128
51
52