186d7f5d3SJohn Marino# Copyright (C) 2008 Red Hat, Inc. All rights reserved. 286d7f5d3SJohn Marino# 386d7f5d3SJohn Marino# This copyrighted material is made available to anyone wishing to use, 486d7f5d3SJohn Marino# modify, copy, or redistribute it subject to the terms and conditions 586d7f5d3SJohn Marino# of the GNU General Public License v.2. 686d7f5d3SJohn Marino# 786d7f5d3SJohn Marino# You should have received a copy of the GNU General Public License 886d7f5d3SJohn Marino# along with this program; if not, write to the Free Software Foundation, 986d7f5d3SJohn Marino# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1086d7f5d3SJohn Marino 1186d7f5d3SJohn Marino# 1286d7f5d3SJohn Marino# tests functionality of lvs, pvs, vgs, *display tools 1386d7f5d3SJohn Marino# 1486d7f5d3SJohn Marino 1586d7f5d3SJohn Marino. ./test-utils.sh 1686d7f5d3SJohn Marino 1786d7f5d3SJohn Marinoget_lvs_() 1886d7f5d3SJohn Marino{ 1986d7f5d3SJohn Marino case $(lvs --units s --nosuffix --noheadings -o $1_read_ahead "$vg"/"$lv") in 2086d7f5d3SJohn Marino *$2) true ;; 2186d7f5d3SJohn Marino *) false ;; 2286d7f5d3SJohn Marino esac 2386d7f5d3SJohn Marino} 2486d7f5d3SJohn Marino 2586d7f5d3SJohn Marinoaux prepare_devs 5 2686d7f5d3SJohn Marino 2786d7f5d3SJohn Marinopvcreate $dev1 2886d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev2 2986d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev3 3086d7f5d3SJohn Marinopvcreate $dev4 3186d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev5 3286d7f5d3SJohn Marino 3386d7f5d3SJohn Marino#COMM bz195276 -- pvs doesn't show PVs until a VG is created 3486d7f5d3SJohn Marinopvs --noheadings|tee out 3586d7f5d3SJohn Marinotest $(wc -l <out) -eq 5 3686d7f5d3SJohn Marino 3786d7f5d3SJohn Marino#COMM pvs with segment attributes works even for orphans 3886d7f5d3SJohn Marinopvs --noheadings -o seg_all,pv_all,lv_all,vg_all | tee out 3986d7f5d3SJohn Marinotest $(wc -l <out) -eq 5 4086d7f5d3SJohn Marino 4186d7f5d3SJohn Marinovgcreate -c n $vg $devs 4286d7f5d3SJohn Marino 4386d7f5d3SJohn Marino#COMM pvs and vgs report mda_count, mda_free (bz202886, bz247444) 4486d7f5d3SJohn Marinopvs -o +pv_mda_count,pv_mda_free $devs 4586d7f5d3SJohn Marinofor I in $dev2 $dev3 $dev5; do 4686d7f5d3SJohn Marino aux check_pv_field_ $I pv_mda_count 0 4786d7f5d3SJohn Marino aux check_pv_field_ $I pv_mda_free 0 4886d7f5d3SJohn Marinodone 4986d7f5d3SJohn Marinovgs -o +vg_mda_count,vg_mda_free $vg 5086d7f5d3SJohn Marinoaux check_vg_field_ $vg vg_mda_count 2 5186d7f5d3SJohn Marino 5286d7f5d3SJohn Marino#COMM pvs doesn't display --metadatacopies 0 PVs as orphans (bz409061) 5386d7f5d3SJohn Marinopvdisplay $dev2|grep "VG Name.*$vg" 5486d7f5d3SJohn Marinotest $(pvs -o vg_name --noheadings $dev2) = $vg 5586d7f5d3SJohn Marino 5686d7f5d3SJohn Marino#COMM lvs displays snapshots (bz171215) 5786d7f5d3SJohn Marinolvcreate -l4 -n $lv1 $vg 5886d7f5d3SJohn Marinolvcreate -l4 -s -n $lv2 $vg/$lv1 5986d7f5d3SJohn Marinolvs $vg --noheadings|tee out 6086d7f5d3SJohn Marinotest $(wc -l <out) -eq 2 6186d7f5d3SJohn Marinolvs -a --noheadings|tee out 6286d7f5d3SJohn Marino# should lvs -a display cow && real devices? (it doesn't) 6386d7f5d3SJohn Marinotest $(wc -l <out) -eq 2 6486d7f5d3SJohn Marinodmsetup ls|grep $PREFIX|grep -v "LVMTEST.*pv." 6586d7f5d3SJohn Marinolvremove -f $vg/$lv2 6686d7f5d3SJohn Marino 6786d7f5d3SJohn Marino#COMM lvs -a displays mirror legs and log 6886d7f5d3SJohn Marinolvcreate -l4 -m2 -n$lv3 $vg 6986d7f5d3SJohn Marinolvs $vg --noheadings|tee out 7086d7f5d3SJohn Marinotest $(wc -l <out) -eq 2 7186d7f5d3SJohn Marinolvs -a --noheadings|tee out 7286d7f5d3SJohn Marinotest $(wc -l <out) -eq 6 7386d7f5d3SJohn Marinodmsetup ls|grep $PREFIX|grep -v "LVMTEST.*pv." 7486d7f5d3SJohn Marino 7586d7f5d3SJohn Marino#COMM vgs with options from pvs still treats arguments as VGs (bz193543) 7686d7f5d3SJohn Marinovgs -o pv_name,vg_name $vg 7786d7f5d3SJohn Marino# would complain if not 7886d7f5d3SJohn Marino 7986d7f5d3SJohn Marino#COMM pvdisplay --maps feature (bz149814) 8086d7f5d3SJohn Marinopvdisplay $devs >out 8186d7f5d3SJohn Marinopvdisplay --maps $devs >out2 8286d7f5d3SJohn Marinonot diff out out2 8386d7f5d3SJohn Marino 84