2014-10-07 04:08:03 +04:00
#!/bin/sh
2014-10-07 11:54:47 +04:00
# Copyright (C) 2008-2014 Red Hat, Inc. All rights reserved.
2014-10-07 04:08:03 +04:00
#
# 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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2014-10-07 04:08:03 +04:00
test_description = 'Exercise toollib process_each_pv'
2016-02-23 01:13:42 +03:00
SKIP_WITH_LVMLOCKD = 1
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2014-10-07 04:08:03 +04:00
. lib/inittest
aux prepare_devs 14
#
# process_each_pv is used by a number of pv commands:
# pvdisplay
# pvresize
# pvs
# vgreduce
#
#
# set up
#
# use use dev10 instead of dev1 because simple grep for
# dev1 matchines dev10,dev11,etc
#
vgcreate $vg1 " $dev10 "
vgcreate $vg2 " $dev2 " " $dev3 " " $dev4 " " $dev5 "
vgcreate $vg3 " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvchange --addtag V2D3 " $dev3 "
pvchange --addtag V2D4 " $dev4 "
pvchange --addtag V2D45 " $dev4 "
pvchange --addtag V2D5 " $dev5 "
pvchange --addtag V2D45 " $dev5 "
pvchange --addtag V3 " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvchange --addtag V3D9 " $dev9 "
# orphan
pvcreate " $dev11 "
# dev (a non-pv device)
pvcreate " $dev12 "
pvremove " $dev12 "
# dev13 is intentionally untouched so we can
# test that it is handled appropriately as a non-pv
# orphan
pvcreate " $dev14 "
#
# test pvresize without orphans and and without non-pv devs
#
# For pvs in vgs, pvresize setphysicalvolumesize does not give us
# the size requested, but reduces the requested size by some the
# amount for alignment, metadata areas and pv headers. So, when we resize
# to 30M, the result is 28M, and when we resize to 20M, the result is 16M.
# For orphans, the resulting size is the same as requested.
# It suspect that these reduction amounts might be inconsistent, and
# depend on other changing factors, so it may be that we eventually
# want to give up checking the exact resulting size, but just check
# that the result is less than the original size.
old_request = "30.00m"
old_reduced = "28.00m"
new_request = "20.00m"
new_reduced = "16.00m"
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# one pv
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev10 "
check pv_field " $dev10 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# two pvs in separate vgs
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev2 " " $dev6 "
check pv_field " $dev2 " pv_size $new_reduced
check pv_field " $dev6 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# one tag on one pv
pvresize --setphysicalvolumesize $new_request @V2D4
2014-10-07 11:54:47 +04:00
check pv_field " $dev4 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# one tag on all pvs in one vg
pvresize --setphysicalvolumesize $new_request @V3
2014-10-07 11:54:47 +04:00
check pv_field " $dev6 " pv_size $new_reduced
check pv_field " $dev7 " pv_size $new_reduced
check pv_field " $dev8 " pv_size $new_reduced
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# one tag on some pvs in one vg
pvresize --setphysicalvolumesize $new_request @V2D45
2014-10-07 11:54:47 +04:00
check pv_field " $dev4 " pv_size $new_reduced
check pv_field " $dev5 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# one tag on multiple pvs in separate vgs
pvchange --addtag V12 " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 "
pvresize --setphysicalvolumesize $new_request @V12
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $new_reduced
check pv_field " $dev2 " pv_size $new_reduced
check pv_field " $dev3 " pv_size $new_reduced
check pv_field " $dev4 " pv_size $new_reduced
check pv_field " $dev5 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# one pv and one tag on different pv
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev10 " @V3D9
check pv_field " $dev10 " pv_size $new_reduced
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# redundant pv and tag
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev9 " @V3D9
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
# two tags on pvs in separate vgs
pvresize --setphysicalvolumesize $new_request @V3D9 @V2D3
2014-10-07 11:54:47 +04:00
check pv_field " $dev9 " pv_size $new_reduced
check pv_field " $dev3 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
2014-10-07 04:08:03 +04:00
#
# test pvresize with orphans
#
old_request = "30.00m"
old_reduced = "28.00m"
old_orphan = "30.00m"
new_request = "20.00m"
new_reduced = "16.00m"
new_orphan = "20.00m"
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# one orphan
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev11 "
check pv_field " $dev11 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# two orphans
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev11 " " $dev14 "
check pv_field " $dev11 " pv_size $new_orphan
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one orphan, one tag
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request @V3D9 " $dev14 "
check pv_field " $dev9 " pv_size $new_reduced
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one pv, one orphan, one tag
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request @V3D9 " $dev14 " " $dev10 "
check pv_field " $dev9 " pv_size $new_reduced
check pv_field " $dev10 " pv_size $new_reduced
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
#
# test pvresize with non-pv devs
#
# one dev (non-pv)
2014-10-07 11:54:47 +04:00
not pvresize --setphysicalvolumesize $new_request " $dev13 "
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# one orphan and one dev (non-pv)
2014-10-07 11:54:47 +04:00
not pvresize --setphysicalvolumesize $new_request " $dev14 " " $dev13 "
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one pv and one dev (non-pv)
2014-10-07 11:54:47 +04:00
not pvresize --setphysicalvolumesize $new_request " $dev9 " " $dev13 "
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one tag and one dev (non-pv)
2014-10-07 11:54:47 +04:00
not pvresize --setphysicalvolumesize $new_request @V3D9 " $dev13 "
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one pv, one orphan, one tag, one dev
2014-10-07 11:54:47 +04:00
not pvresize --setphysicalvolumesize $new_request @V3D9 " $dev13 " " $dev14 " " $dev10 "
check pv_field " $dev9 " pv_size $new_reduced
check pv_field " $dev10 " pv_size $new_reduced
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
#
# pvresize including pvs without mdas
#
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# one pv without mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev2 "
check pv_field " $dev2 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# two pvs without mdas
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev6 " " $dev7 "
check pv_field " $dev6 " pv_size $new_reduced
check pv_field " $dev7 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one pv with mda and one pv without mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev8 " " $dev9 "
check pv_field " $dev8 " pv_size $new_reduced
check pv_field " $dev9 " pv_size $new_reduced
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one orphan with mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev11 "
check pv_field " $dev11 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev14 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one orphan without mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev14 "
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
check pv_field " $dev11 " pv_size $old_orphan
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one orphan with mda and one orphan without mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev14 " " $dev11 "
check pv_field " $dev11 " pv_size $new_orphan
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
check pv_field " $dev8 " pv_size $old_reduced
check pv_field " $dev9 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "
2014-10-07 04:08:03 +04:00
# one pv with mda and one pv without mda, and
# one orphan with mda and one orphan without mda
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $new_request " $dev8 " " $dev9 " " $dev14 " " $dev11 "
check pv_field " $dev8 " pv_size $new_reduced
check pv_field " $dev9 " pv_size $new_reduced
check pv_field " $dev11 " pv_size $new_orphan
check pv_field " $dev14 " pv_size $new_orphan
2014-10-07 04:08:03 +04:00
# unchanged
2014-10-07 11:54:47 +04:00
check pv_field " $dev10 " pv_size $old_reduced
check pv_field " $dev2 " pv_size $old_reduced
check pv_field " $dev3 " pv_size $old_reduced
check pv_field " $dev4 " pv_size $old_reduced
check pv_field " $dev5 " pv_size $old_reduced
check pv_field " $dev6 " pv_size $old_reduced
check pv_field " $dev7 " pv_size $old_reduced
2014-10-07 04:08:03 +04:00
# reset back to old size
2014-10-07 11:54:47 +04:00
pvresize --setphysicalvolumesize $old_request " $dev10 " " $dev2 " " $dev3 " " $dev4 " " $dev5 " " $dev6 " " $dev7 " " $dev8 " " $dev9 "
pvresize --setphysicalvolumesize $old_request " $dev11 " " $dev14 "