2012-03-16 17:00:05 +04:00
#!/bin/sh
2008-11-11 18:29:24 +03:00
# Copyright (C) 2008 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
#
# tests functionality of lvs, pvs, vgs, *display tools
#
2011-01-05 03:16:18 +03:00
. lib/test
2008-11-11 18:29:24 +03:00
aux prepare_devs 5
2012-03-16 17:00:05 +04:00
pvcreate " $dev1 "
pvcreate --metadatacopies 0 " $dev2 "
pvcreate --metadatacopies 0 " $dev3 "
pvcreate " $dev4 "
pvcreate --metadatacopies 0 " $dev5 "
2008-11-11 18:29:24 +03:00
#COMM bz195276 -- pvs doesn't show PVs until a VG is created
2012-03-16 17:00:05 +04:00
test $( pvs --noheadings $( cat DEVICES) | wc -l) -eq 5
2008-11-11 18:29:24 +03:00
2009-04-21 16:59:18 +04:00
#COMM pvs with segment attributes works even for orphans
2012-03-16 17:00:05 +04:00
test $( pvs --noheadings -o seg_all,pv_all,lv_all,vg_all $( cat DEVICES) | wc -l) -eq 5
2009-04-21 16:59:18 +04:00
2011-01-05 03:16:18 +03:00
vgcreate -c n $vg $( cat DEVICES)
2008-11-11 18:29:24 +03:00
#COMM pvs and vgs report mda_count, mda_free (bz202886, bz247444)
2011-01-05 03:16:18 +03:00
pvs -o +pv_mda_count,pv_mda_free $( cat DEVICES)
2012-03-16 17:00:05 +04:00
for I in " $dev2 " " $dev3 " " $dev5 " ; do
2011-01-05 03:16:18 +03:00
check pv_field $I pv_mda_count 0
check pv_field $I pv_mda_free 0
2008-11-11 18:29:24 +03:00
done
vgs -o +vg_mda_count,vg_mda_free $vg
2011-01-05 03:16:18 +03:00
check vg_field $vg vg_mda_count 2
2008-11-11 18:29:24 +03:00
#COMM pvs doesn't display --metadatacopies 0 PVs as orphans (bz409061)
2012-03-16 17:00:05 +04:00
pvdisplay " $dev2 " | grep " VG Name.* $vg "
check pv_field " $dev2 " vg_name $vg
2008-11-11 18:29:24 +03:00
#COMM lvs displays snapshots (bz171215)
lvcreate -l4 -n $lv1 $vg
lvcreate -l4 -s -n $lv2 $vg /$lv1
2012-03-16 17:00:05 +04:00
test $( lvs --noheadings $vg | wc -l) -eq 2
2008-11-11 18:29:24 +03:00
# should lvs -a display cow && real devices? (it doesn't)
2012-03-16 17:00:05 +04:00
test $( lvs -a --noheadings $vg | wc -l) -eq 2
2008-11-11 18:29:24 +03:00
dmsetup ls| grep $PREFIX | grep -v "LVMTEST.*pv."
lvremove -f $vg /$lv2
#COMM lvs -a displays mirror legs and log
2012-03-16 17:00:05 +04:00
lvcreate -l4 -m2 -n $lv3 $vg
test $( lvs --noheadings $vg | wc -l) -eq 2
test $( lvs -a --noheadings $vg | wc -l) -eq 6
2008-11-11 18:29:24 +03:00
dmsetup ls| grep $PREFIX | grep -v "LVMTEST.*pv."
#COMM vgs with options from pvs still treats arguments as VGs (bz193543)
vgs -o pv_name,vg_name $vg
# would complain if not
#COMM pvdisplay --maps feature (bz149814)
2011-01-05 03:16:18 +03:00
pvdisplay $( cat DEVICES) >out
pvdisplay --maps $( cat DEVICES) >out2
2008-11-11 18:29:24 +03:00
not diff out out2