mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
test: add process-each-vg and process-each-lv
These test the toollib functions that select vgs/lvs to process based on command line args: empty, vg name(s), lv names(s), vg tag(s), lv tags(s), and combinations of all.
This commit is contained in:
parent
506bc045b5
commit
7d6a125e97
954
test/shell/process-each-lv.sh
Normal file
954
test/shell/process-each-lv.sh
Normal file
@ -0,0 +1,954 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2008-2013 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_description='Exercise toollib process_each_lv'
|
||||
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 10
|
||||
|
||||
#
|
||||
# process_each_lv is used by a number of lv commands:
|
||||
# lvconvert lv (none is error)
|
||||
# lvchange vg|lv (none is error)
|
||||
# lvremove vg|lv (none is error)
|
||||
# lvdisplay [vg|lv] (none is all)
|
||||
# vgmknodes [vg|lv] (none is all)
|
||||
# lvs [vg|lv] (none is all)
|
||||
# lvscan (none is all)
|
||||
#
|
||||
# (lv can also be a tag matching an lv tag, and
|
||||
# vg can also be a tag matching a vg tag.)
|
||||
#
|
||||
# The logic in process_each_vl is mainly related to
|
||||
# selecting which vgs/lvs to process.
|
||||
#
|
||||
|
||||
#
|
||||
# test lvremove vg|lv names
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
not lvremove
|
||||
not lvremove garbage
|
||||
not lvremove $vg1/garbage
|
||||
|
||||
lvremove $vg1
|
||||
lvs $vg1
|
||||
not lvs $vg1/$lv1
|
||||
vgremove $vg1
|
||||
|
||||
lvremove $vg2
|
||||
lvs $vg2
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
vgremove $vg2
|
||||
|
||||
lvremove $vg3/$lv1
|
||||
lvremove $vg3/$lv2 $vg3/$lv3
|
||||
lvs $vg3
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
vgremove $vg3
|
||||
|
||||
lvremove $vg4
|
||||
lvs $vg4
|
||||
vgremove $vg4
|
||||
|
||||
lvremove $vg5/$lv1 $vg5 $vg5/$lv3
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove vg|lv names from multiple vgs
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove $vg2 $vg3/$lv3 $vg5/$lv1
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
not lvs $vg5/$lv1
|
||||
|
||||
lvremove $vg2 $vg1
|
||||
not lvs $vg1/$lv1
|
||||
|
||||
lvremove $vg3/$lv1 $vg3 $vg4 $vg5/$lv2
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg5/$lv2
|
||||
|
||||
lvremove $vg5 $vg1 $vg5/$lv3
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove @lvtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
lvchange --addtag V1L1 $vg1/$lv1
|
||||
lvchange --addtag V2L1 $vg2/$lv1
|
||||
lvchange --addtag V2L2 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg2/$lv1
|
||||
lvchange --addtag V23 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv1
|
||||
lvchange --addtag V23 $vg3/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv3
|
||||
lvchange --addtag V3L2 $vg3/$lv2
|
||||
lvchange --addtag V3L3A $vg3/$lv3
|
||||
lvchange --addtag V3L3B $vg3/$lv3
|
||||
lvchange --addtag V5L1 $vg5/$lv1
|
||||
lvchange --addtag V5L234 $vg5/$lv2
|
||||
lvchange --addtag V5L234 $vg5/$lv3
|
||||
lvchange --addtag V5L234 $vg5/$lv4
|
||||
lvchange --addtag V5L5 $vg5/$lv5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
# verify all exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
lvs $vg3/$lv3
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv2
|
||||
lvs $vg5/$lv3
|
||||
lvs $vg5/$lv4
|
||||
lvs $vg5/$lv5
|
||||
|
||||
lvremove @garbage
|
||||
|
||||
lvremove @V3L3A
|
||||
not lvs $vg3/$lv3
|
||||
# verify unremoved still exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv2
|
||||
lvs $vg5/$lv3
|
||||
lvs $vg5/$lv4
|
||||
lvs $vg5/$lv5
|
||||
|
||||
lvremove @V5L234
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
# verify unremoved still exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv5
|
||||
|
||||
lvremove @V5L1 @V5L5
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved still exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
|
||||
lvremove @V23 @V1L1 @V3L2
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove @vgtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove @V4
|
||||
# verify unremoved exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
lvs $vg3/$lv3
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv2
|
||||
lvs $vg5/$lv3
|
||||
lvs $vg5/$lv4
|
||||
lvs $vg5/$lv5
|
||||
|
||||
lvremove @V5
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv2
|
||||
lvs $vg3/$lv3
|
||||
|
||||
lvremove @V1 @V23
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove @V35 @V5
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved exist
|
||||
lvs $vg1/$lv1
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
|
||||
lvremove @V1 @V23
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove vg|lv names and @lvtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
lvchange --addtag V1L1 $vg1/$lv1
|
||||
lvchange --addtag V2L1 $vg2/$lv1
|
||||
lvchange --addtag V2L2 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg2/$lv1
|
||||
lvchange --addtag V23 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv1
|
||||
lvchange --addtag V23 $vg3/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv3
|
||||
lvchange --addtag V3L2 $vg3/$lv2
|
||||
lvchange --addtag V3L3A $vg3/$lv3
|
||||
lvchange --addtag V3L3B $vg3/$lv3
|
||||
lvchange --addtag V5L1 $vg5/$lv1
|
||||
lvchange --addtag V5L234 $vg5/$lv2
|
||||
lvchange --addtag V5L234 $vg5/$lv3
|
||||
lvchange --addtag V5L234 $vg5/$lv4
|
||||
lvchange --addtag V5L5 $vg5/$lv5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove $vg1/$lv1 @V3L2 @V5L234
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
# verify unremoved exist
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
lvs $vg3/$lv1
|
||||
lvs $vg3/$lv3
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv5
|
||||
|
||||
lvremove $vg2/$lv1 @V23 $vg5/$lv1 @V5L5
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove vg|lv names and @vgtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove $vg1/$lv1 @V35
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved exist
|
||||
lvs $vg2/$lv1
|
||||
lvs $vg2/$lv2
|
||||
|
||||
lvremove $vg2/$lv1 @V23 $vg2/$lv2
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove @lvtags and @vgtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
lvchange --addtag V1L1 $vg1/$lv1
|
||||
lvchange --addtag V2L1 $vg2/$lv1
|
||||
lvchange --addtag V2L2 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg2/$lv1
|
||||
lvchange --addtag V23 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv1
|
||||
lvchange --addtag V23 $vg3/$lv2
|
||||
# to check that vg tag @V23 includes this
|
||||
# lvchange --addtag V23 $vg3/$lv3
|
||||
lvchange --addtag V3L2 $vg3/$lv2
|
||||
lvchange --addtag V3L3A $vg3/$lv3
|
||||
lvchange --addtag V3L3B $vg3/$lv3
|
||||
lvchange --addtag V5L1 $vg5/$lv1
|
||||
lvchange --addtag V5L234 $vg5/$lv2
|
||||
lvchange --addtag V5L234 $vg5/$lv3
|
||||
lvchange --addtag V5L234 $vg5/$lv4
|
||||
lvchange --addtag V5L5 $vg5/$lv5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove @V23 @V35
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved exist
|
||||
lvs $vg1/$lv1
|
||||
|
||||
lvremove @V1 @V1L1
|
||||
not lvs $vg1/$lv1
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvremove vg|lv names and @lvtags and @vgtags
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
lvchange --addtag V1L1 $vg1/$lv1
|
||||
lvchange --addtag V2L1 $vg2/$lv1
|
||||
lvchange --addtag V2L2 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg2/$lv1
|
||||
lvchange --addtag V23 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv1
|
||||
lvchange --addtag V23 $vg3/$lv2
|
||||
# to check that vg tag @V23 includes this
|
||||
# lvchange --addtag V23 $vg3/$lv3
|
||||
lvchange --addtag V3L2 $vg3/$lv2
|
||||
lvchange --addtag V3L3A $vg3/$lv3
|
||||
lvchange --addtag V3L3B $vg3/$lv3
|
||||
lvchange --addtag V5L1 $vg5/$lv1
|
||||
lvchange --addtag V5L234 $vg5/$lv2
|
||||
lvchange --addtag V5L234 $vg5/$lv3
|
||||
lvchange --addtag V5L234 $vg5/$lv4
|
||||
lvchange --addtag V5L5 $vg5/$lv5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
lvremove $vg1/$lv1 @V23 @V5L5
|
||||
not lvs $vg1/$lv1
|
||||
not lvs $vg2/$lv1
|
||||
not lvs $vg2/$lv2
|
||||
not lvs $vg3/$lv1
|
||||
not lvs $vg3/$lv2
|
||||
not lvs $vg3/$lv3
|
||||
not lvs $vg5/$lv5
|
||||
# verify unremoved exist
|
||||
lvs $vg5/$lv1
|
||||
lvs $vg5/$lv2
|
||||
lvs $vg5/$lv3
|
||||
lvs $vg5/$lv4
|
||||
|
||||
lvremove $vg5/$lv2 @V5L234 @V5
|
||||
not lvs $vg5/$lv1
|
||||
not lvs $vg5/$lv2
|
||||
not lvs $vg5/$lv3
|
||||
not lvs $vg5/$lv4
|
||||
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgremove $vg3
|
||||
vgremove $vg4
|
||||
vgremove $vg5
|
||||
|
||||
|
||||
#
|
||||
# test lvs: empty, vg(s), lv(s), vgtag(s), lvtag(s), garbage, combinations
|
||||
#
|
||||
|
||||
# set up vgs/lvs that we will remove
|
||||
vgcreate $vg1 "$dev1" "$dev2"
|
||||
vgcreate $vg2 "$dev3" "$dev4"
|
||||
vgcreate $vg3 "$dev5" "$dev6"
|
||||
vgcreate $vg4 "$dev7" "$dev8"
|
||||
vgcreate $vg5 "$dev9" "$dev10"
|
||||
lvcreate -l 2 -n $lv1 $vg1
|
||||
lvcreate -l 2 -n $lv1 $vg2
|
||||
lvcreate -l 2 -n $lv2 $vg2
|
||||
lvcreate -l 2 -n $lv1 $vg3
|
||||
lvcreate -l 2 -n $lv2 $vg3
|
||||
lvcreate -l 2 -n $lv3 $vg3
|
||||
lvcreate -l 2 -n $lv1 $vg5
|
||||
lvcreate -l 2 -n $lv2 $vg5
|
||||
lvcreate -l 2 -n $lv3 $vg5
|
||||
lvcreate -l 2 -n $lv4 $vg5
|
||||
lvcreate -l 2 -n $lv5 $vg5
|
||||
lvchange --addtag V1L1 $vg1/$lv1
|
||||
lvchange --addtag V2L1 $vg2/$lv1
|
||||
lvchange --addtag V2L2 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg2/$lv1
|
||||
lvchange --addtag V23 $vg2/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv1
|
||||
lvchange --addtag V23 $vg3/$lv2
|
||||
lvchange --addtag V23 $vg3/$lv3
|
||||
lvchange --addtag V3L2 $vg3/$lv2
|
||||
lvchange --addtag V3L3A $vg3/$lv3
|
||||
lvchange --addtag V3L3B $vg3/$lv3
|
||||
lvchange --addtag V5L1 $vg5/$lv1
|
||||
lvchange --addtag V5L234 $vg5/$lv2
|
||||
lvchange --addtag V5L234 $vg5/$lv3
|
||||
lvchange --addtag V5L234 $vg5/$lv4
|
||||
lvchange --addtag V5L5 $vg5/$lv5
|
||||
vgchange --addtag V1 $vg1
|
||||
vgchange --addtag V23 $vg2
|
||||
vgchange --addtag V23 $vg3
|
||||
vgchange --addtag V35 $vg3
|
||||
vgchange --addtag V4 $vg4
|
||||
vgchange --addtag V35 $vg5
|
||||
vgchange --addtag V5 $vg5
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vgchange -an $vg3
|
||||
vgchange -an $vg4
|
||||
vgchange -an $vg5
|
||||
|
||||
# empty
|
||||
lvs -o vg_name,lv_name --separator '-' >err
|
||||
grep $vg1-$lv1 err
|
||||
grep $vg2-$lv1 err
|
||||
grep $vg2-$lv2 err
|
||||
grep $vg3-$lv1 err
|
||||
grep $vg3-$lv2 err
|
||||
grep $vg3-$lv3 err
|
||||
grep $vg5-$lv1 err
|
||||
grep $vg5-$lv2 err
|
||||
grep $vg5-$lv3 err
|
||||
grep $vg5-$lv4 err
|
||||
grep $vg5-$lv5 err
|
||||
|
||||
# vg
|
||||
lvs -o vg_name,lv_name --separator '-' $vg1 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# vgs
|
||||
lvs -o vg_name,lv_name --separator '-' $vg1 $vg2 >err
|
||||
grep $vg1-$lv1 err
|
||||
grep $vg2-$lv1 err
|
||||
grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# lv
|
||||
lvs -o vg_name,lv_name --separator '-' $vg1/$lv1 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# lvs
|
||||
lvs -o vg_name,lv_name --separator '-' $vg1/$lv1 $vg2/$lv1 $vg2/$lv2 >err
|
||||
grep $vg1-$lv1 err
|
||||
grep $vg2-$lv1 err
|
||||
grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# vgtag
|
||||
lvs -o vg_name,lv_name --separator '-' @V1 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# vgtags
|
||||
lvs -o vg_name,lv_name --separator '-' @V1 @V35 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
grep $vg3-$lv1 err
|
||||
grep $vg3-$lv2 err
|
||||
grep $vg3-$lv3 err
|
||||
grep $vg5-$lv1 err
|
||||
grep $vg5-$lv2 err
|
||||
grep $vg5-$lv3 err
|
||||
grep $vg5-$lv4 err
|
||||
grep $vg5-$lv5 err
|
||||
|
||||
# lvtag
|
||||
lvs -o vg_name,lv_name --separator '-' @V1L1 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# lvtags
|
||||
lvs -o vg_name,lv_name --separator '-' @V1L1 @V5L234 >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
grep $vg5-$lv2 err
|
||||
grep $vg5-$lv3 err
|
||||
grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# vg and lv and vgtag and lvtag
|
||||
lvs -o vg_name,lv_name --separator '-' $vg2 $vg5/$lv5 @V1 @V5L234 >err
|
||||
grep $vg1-$lv1 err
|
||||
grep $vg2-$lv1 err
|
||||
grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
grep $vg5-$lv2 err
|
||||
grep $vg5-$lv3 err
|
||||
grep $vg5-$lv4 err
|
||||
grep $vg5-$lv5 err
|
||||
|
||||
# garbage name gives an error if used without a tag
|
||||
|
||||
not lvs -o vg_name,lv_name --separator '-' garbage >err
|
||||
not grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
not lvs -o vg_name,lv_name --separator '-' $vg1/$lv1 garbage >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# garbage name does not give an error if used with a tag
|
||||
|
||||
lvs -o vg_name,lv_name --separator '-' @V1 garbage >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
lvs -o vg_name,lv_name --separator '-' @garbage garbage >err
|
||||
not grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
# garbage tag never gives an error
|
||||
|
||||
lvs -o vg_name,lv_name --separator '-' @V1 @garbage >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
lvs -o vg_name,lv_name --separator '-' $vg1/$lv1 @garbage >err
|
||||
grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
||||
lvs -o vg_name,lv_name --separator '-' @garbage >err
|
||||
not grep $vg1-$lv1 err
|
||||
not grep $vg2-$lv1 err
|
||||
not grep $vg2-$lv2 err
|
||||
not grep $vg3-$lv1 err
|
||||
not grep $vg3-$lv2 err
|
||||
not grep $vg3-$lv3 err
|
||||
not grep $vg5-$lv1 err
|
||||
not grep $vg5-$lv2 err
|
||||
not grep $vg5-$lv3 err
|
||||
not grep $vg5-$lv4 err
|
||||
not grep $vg5-$lv5 err
|
||||
|
264
test/shell/process-each-vg.sh
Normal file
264
test/shell/process-each-vg.sh
Normal file
@ -0,0 +1,264 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2008-2013 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_description='Exercise toollib process_each_vg'
|
||||
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 6
|
||||
|
||||
#
|
||||
# process_each_vg is used by a number of vg commands;
|
||||
# use 'vgremove' and 'vgs' to test it.
|
||||
#
|
||||
# The logic in process_each_vg is mainly related to
|
||||
# selecting which vg's to process.
|
||||
#
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate $vg1 "$dev1"
|
||||
vgcreate $vg2 "$dev2"
|
||||
vgcreate $vg3 "$dev3"
|
||||
vgcreate $vg4 "$dev4"
|
||||
|
||||
# these two vgs will not be removed
|
||||
vgcreate $vg5 "$dev5"
|
||||
vgchange --addtag tagvg5 $vg5
|
||||
lvcreate -l 4 -n $lv1 $vg5
|
||||
vgcreate $vg6 "$dev6"
|
||||
lvcreate -l 4 -n $lv2 $vg6
|
||||
|
||||
# should fail without any arg
|
||||
not vgremove
|
||||
|
||||
# should succeed
|
||||
vgremove $vg1
|
||||
vgremove $vg2 $vg3 $vg4
|
||||
|
||||
# these should fail because they are already removed
|
||||
not vgremove $vg1
|
||||
not vgremove $vg2
|
||||
not vgremove $vg3
|
||||
not vgremove $vg4
|
||||
|
||||
# these should fail because they have lvs in them
|
||||
not vgremove $vg5
|
||||
not vgremove $vg6
|
||||
|
||||
# check that the vgs we removed are gone
|
||||
not vgs $vg1
|
||||
not vgs $vg2
|
||||
not vgs $vg3
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
# should do nothing and fail
|
||||
not vgremove garbage
|
||||
|
||||
# should find nothing to remove
|
||||
vgremove @garbage
|
||||
|
||||
# should find nothing to remove
|
||||
vgremove @$vg1
|
||||
|
||||
# should succeed
|
||||
vgremove $vg1
|
||||
not vgs $vg1
|
||||
|
||||
vgremove $vg2 $vg3 $vg4
|
||||
not vgs $vg2
|
||||
not vgs $vg3
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
vgremove @tagfoo
|
||||
not vgs $vg1
|
||||
not vgs $vg2
|
||||
|
||||
vgremove @tagfoo2 @tagbar
|
||||
not vgs $vg3
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
vgremove $vg1 @tagfoo2
|
||||
not vgs $vg1
|
||||
not vgs $vg3
|
||||
|
||||
vgremove @tagbar $vg2
|
||||
not vgs $vg2
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
vgremove @foo @tagfoo2 $vg1 $vg2
|
||||
not vgs $vg1
|
||||
not vgs $vg2
|
||||
not vgs $vg3
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
vgremove @tagfoo $vg1 @tagfoo @tagfoo2 $vg3 @tagbar
|
||||
not vgs $vg1
|
||||
not vgs $vg2
|
||||
not vgs $vg3
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will remove
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
not vgremove garbage $vg1
|
||||
not vgs $vg1
|
||||
|
||||
not vgremove $vg2 garbage
|
||||
not vgs $vg2
|
||||
|
||||
vgremove $vg3 @garbage
|
||||
not vgs $vg3
|
||||
|
||||
vgremove @garbage $vg4
|
||||
not vgs $vg4
|
||||
|
||||
|
||||
#
|
||||
# end vgremove tests
|
||||
# check that the two vgs we did not intend to remove
|
||||
# are still there, and then remove them
|
||||
#
|
||||
vgs $vg5
|
||||
vgs $vg6
|
||||
vgremove -f $vg5
|
||||
vgremove -f $vg6
|
||||
not vgs $vg5
|
||||
not vgs $vg6
|
||||
|
||||
|
||||
#
|
||||
# set up four vgs that we will report
|
||||
#
|
||||
vgcreate --addtag tagfoo $vg1 "$dev1"
|
||||
vgcreate --addtag tagfoo $vg2 "$dev2"
|
||||
vgcreate --addtag tagfoo2 $vg3 "$dev3"
|
||||
vgcreate --addtag tagbar $vg4 "$dev4"
|
||||
vgchange --addtag foo $vg4
|
||||
|
||||
vgs >err
|
||||
grep $vg1 err
|
||||
grep $vg2 err
|
||||
grep $vg3 err
|
||||
grep $vg4 err
|
||||
|
||||
vgs $vg1 $vg2 >err
|
||||
grep $vg1 err
|
||||
grep $vg2 err
|
||||
not grep $vg3 err
|
||||
not grep $vg4 err
|
||||
|
||||
vgs @tagfoo >err
|
||||
grep $vg1 err
|
||||
grep $vg2 err
|
||||
not grep $vg3 err
|
||||
not grep $vg4 err
|
||||
|
||||
vgs @tagfoo2 >err
|
||||
grep $vg3 err
|
||||
not grep $vg1 err
|
||||
not grep $vg2 err
|
||||
not grep $vg4 err
|
||||
|
||||
vgs @tagfoo2 @tagbar >err
|
||||
grep $vg3 err
|
||||
grep $vg4 err
|
||||
not grep $vg1 err
|
||||
not grep $vg2 err
|
||||
|
||||
vgs $vg1 @tagbar >err
|
||||
grep $vg1 err
|
||||
grep $vg4 err
|
||||
not grep $vg2 err
|
||||
not grep $vg3 err
|
||||
|
||||
vgs $vg1 @tagfoo >err
|
||||
grep $vg1 err
|
||||
grep $vg2 err
|
||||
not grep $vg3 err
|
||||
not grep $vg4 err
|
||||
|
||||
not vgs garbage >err
|
||||
not grep $vg1 err
|
||||
not grep $vg2 err
|
||||
not grep $vg3 err
|
||||
not grep $vg4 err
|
||||
|
||||
not vgs garbage $vg1 >err
|
||||
grep $vg1 err
|
||||
not grep $vg2 err
|
||||
not grep $vg3 err
|
||||
not grep $vg4 err
|
||||
|
||||
vgs @garbage @foo >err
|
||||
grep $vg4 err
|
||||
not grep $vg1 err
|
||||
not grep $vg2 err
|
||||
not grep $vg3 err
|
||||
|
Loading…
Reference in New Issue
Block a user