1 # Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13 dmsetup_has_dm_devdir_support_ ||
exit 200
19 local lv
=$1 #allready vg/lv
21 lvs
-a -odevices --noheadings $lv |
sed 's/,/\n/g' > out
22 #is on all specified devs
23 for d
in $
*; do grep "$d(" out
; done
24 #isn't on any other dev (we are set -e remember)
25 for d
in $
*; do ! grep -v "$d(" out
; done
37 echo "Check if mirror images of $lv are on PVs $pvs"
39 echo $pvs |
sed 's/ /\n/g' |
sort |
uniq > out1
41 mimages
=$
(lvs
--noheadings -a -o lv_name
$vg |
grep "${lv}_mimage_" | \
42 sed 's/\[//g; s/\]//g')
44 echo "Checking $vg/$i"
45 lvs
-a -odevices --noheadings $vg/$i | \
46 sed 's/([^)]*)//g; s/ //g; s/,/ /g' |
sort |
uniq >> out2
49 diff --ignore-blank-lines out1 out2
52 # ---------------------------------------------------------------------
53 # Common environment setup/cleanup for each sub testcases
58 if dmsetup table|
grep $vg; then
59 echo "ERROR: lvremove did leave some some mappings in DM behind!"
65 check_and_cleanup_lvs_
()
69 if dmsetup table|
grep $vg; then
70 echo "ERROR: lvremove did leave some some mappings in DM behind!"
76 check_and_cleanup_lvs_
79 #COMM "convert from 2-way mirror to linear -- specify leg to remove (bz453643)"
81 lvcreate
-l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
82 lvconvert
-m0 $vg/$lv1 $dev2
83 lv_is_on_
$vg/$lv1 $dev1
84 check_and_cleanup_lvs_
87 lvcreate
-l2 -m2 -n $lv1 $vg $dev1 $dev2 $dev4 $dev3:0-1
88 lvconvert
-m-1 $vg/$lv1 $dev1
90 mimages_are_on_
$lv1 $dev2 $dev4
91 lvconvert
-m-1 $vg/$lv1 $dev2
93 lv_is_on_
$vg/$lv1 $dev4
94 check_and_cleanup_lvs_