1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Fix topology test.

Kernel version is misparsed in Fedora rawhide, just test sysfs file.

SCSI_DEBUG_DEV is no longer exported, use provided file instead.
This commit is contained in:
Milan Broz 2011-06-09 14:26:47 +00:00
parent afc8a3b104
commit aa809cb877

View File

@ -10,22 +10,16 @@
which mkfs.ext3 || exit 200 which mkfs.ext3 || exit 200
# Get linux minor version
linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1)
test $linux_minor -ge 31 || exit 200
. lib/test . lib/test
check_logical_block_size() check_logical_block_size()
{ {
local DEV_=$1 local DEV_=$(cat SCSI_DEBUG_DEV)
local LOGICAL_BS=$2
# Verify logical_block_size - requires Linux >= 2.6.31 # Verify logical_block_size - requires Linux >= 2.6.31
SYSFS_LOGICAL_BLOCK_SIZE=`echo /sys/block/$(basename $DEV_)/queue/logical_block_size` SYSFS_LOGICAL_BLOCK_SIZE=`echo /sys/block/$(basename $DEV_)/queue/logical_block_size`
if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then
ACTUAL_LOGICAL_BLOCK_SIZE=`cat $SYSFS_LOGICAL_BLOCK_SIZE` ACTUAL_LOGICAL_BLOCK_SIZE=`cat $SYSFS_LOGICAL_BLOCK_SIZE`
test $ACTUAL_LOGICAL_BLOCK_SIZE = $LOGICAL_BS test $ACTUAL_LOGICAL_BLOCK_SIZE = $1
fi fi
} }
@ -60,13 +54,21 @@ NUM_DEVS=1
PER_DEV_SIZE=34 PER_DEV_SIZE=34
DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE)) DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
# Test that kernel supports topology
aux prepare_scsi_debug_dev $DEV_SIZE
if [ ! -e /sys/block/$(basename $(cat SCSI_DEBUG_DEV))/alignment_offset ] ; then
aux cleanup_scsi_debug_dev
exit 200
fi
aux cleanup_scsi_debug_dev
# --------------------------------------------- # ---------------------------------------------
# Create "desktop-class" 4K drive # Create "desktop-class" 4K drive
# (logical_block_size=512, physical_block_size=4096, alignment_offset=0): # (logical_block_size=512, physical_block_size=4096, alignment_offset=0):
LOGICAL_BLOCK_SIZE=512 LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \ aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES) vgcreate -c n $vg $(cat DEVICES)
@ -81,7 +83,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=512 LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \ aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES) vgcreate -c n $vg $(cat DEVICES)
@ -96,7 +98,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=4096 LOGICAL_BLOCK_SIZE=4096
aux prepare_scsi_debug_dev $DEV_SIZE \ aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE sector_size=$LOGICAL_BLOCK_SIZE
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES) vgcreate -c n $vg $(cat DEVICES)