1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: deal with kernel and broken lcm

If the kernel has 'new lcm()' (3.19) it provides wrong
optimal_io_size value for dm device so lvm2 command cannot
create properly aligned devices.

Use 'should' for this case - so test ends with 'TEST WARNING'.
This commit is contained in:
Zdenek Kabelac 2015-04-02 12:22:59 +02:00
parent 7a6e3838e9
commit 536f5fa0a3
2 changed files with 24 additions and 23 deletions

View File

@ -24,7 +24,15 @@ aux prepare_profiles "thin-performance"
# Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size # Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size
aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip
EXPECT=1048576
check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" optimal_io_size "$EXPECT"
aux prepare_pvs 1 $DEV_SIZE aux prepare_pvs 1 $DEV_SIZE
# Check we are not running on buggy kernel (broken lcm())
# If so, turn chunk_size test into 'should'
MINOR=$(stat -c %T "$dev1")
check sysfs_queue "dm-$MINOR" optimal_io_size "$EXPECT" || SHOULD=should
vgcreate $vg "$dev1" vgcreate $vg "$dev1"
# By default, "generic" policy is used to # By default, "generic" policy is used to
@ -43,7 +51,7 @@ check lv_field $vg/pool_generic zero "zero"
# under "thin-perforance" profile. # under "thin-perforance" profile.
lvcreate --profile thin-performance -L8m -T $vg/pool_performance lvcreate --profile thin-performance -L8m -T $vg/pool_performance
check lv_field $vg/pool_performance profile "thin-performance" check lv_field $vg/pool_performance profile "thin-performance"
check lv_field $vg/pool_performance chunk_size 1.00m $SHOULD check lv_field $vg/pool_performance chunk_size 1.00m
check lv_field $vg/pool_performance zero "" check lv_field $vg/pool_performance zero ""
vgremove -ff $vg vgremove -ff $vg
@ -55,5 +63,5 @@ lvcreate -L8m -T $vg/pool_performance_inherited
# ...the LV does not have the profile attached, but VG does! # ...the LV does not have the profile attached, but VG does!
check vg_field $vg profile "thin-performance" check vg_field $vg profile "thin-performance"
check lv_field $vg/pool_performance_inherited profile "" check lv_field $vg/pool_performance_inherited profile ""
check lv_field $vg/pool_performance_inherited chunk_size 1.00m $SHOULD check lv_field $vg/pool_performance_inherited chunk_size 1.00m
check lv_field $vg/pool_performance_inherited zero "" check lv_field $vg/pool_performance_inherited zero ""

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2010 Red Hat, Inc. All rights reserved. # Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
# #
# This copyrighted material is made available to anyone wishing to use, # This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions # modify, copy, or redistribute it subject to the terms and conditions
@ -13,20 +13,6 @@
which mkfs.ext3 || skip which mkfs.ext3 || skip
check_logical_block_size() {
# Verify logical_block_size - requires Linux >= 2.6.31
SYSFS_LOGICAL_BLOCK_SIZE="/sys/block/$(basename $(< SCSI_DEBUG_DEV))/queue/logical_block_size"
test -f "$SYSFS_LOGICAL_BLOCK_SIZE" || return 0
test "$(< $SYSFS_LOGICAL_BLOCK_SIZE)" -eq "$1" # ACTUAL_LOGICAL_BLOCK_SIZE
}
check_optimal_io_size() {
# Verify optimal_io_size
SYSFS_OPTIMAL_IO_SIZE="/sys/block/$(basename $(< SCSI_DEBUG_DEV))/queue/optimal_io_size"
test -f "$SYSFS_OPTIMAL_IO_SIZE" || return 0
test "$(< $SYSFS_OPTIMAL_IO_SIZE)" -eq "$1" # ACTUAL_OPTIMAL_IO_SIZE
}
lvdev_() { lvdev_() {
echo "$DM_DEV_DIR/$1/$2" echo "$DM_DEV_DIR/$1/$2"
} }
@ -70,7 +56,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 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
check_logical_block_size $LOGICAL_BLOCK_SIZE check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
get_devs get_devs
@ -87,7 +73,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 $LOGICAL_BLOCK_SIZE check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate $vg "${DEVICES[@]}" vgcreate $vg "${DEVICES[@]}"
@ -102,7 +88,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 $LOGICAL_BLOCK_SIZE check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate $vg "${DEVICES[@]}" vgcreate $vg "${DEVICES[@]}"
@ -118,10 +104,17 @@ 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 opt_blks=1536 sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
check_logical_block_size $LOGICAL_BLOCK_SIZE
check_optimal_io_size 786432 TDEV="$(basename $(< SCSI_DEBUG_DEV))"
check sysfs_queue "$TDEV" logical_block_size $LOGICAL_BLOCK_SIZE
check sysfs_queue "$TDEV" optimal_io_size 786432
aux prepare_pvs 1 $PER_DEV_SIZE aux prepare_pvs 1 $PER_DEV_SIZE
check pv_field "${DEVICES[@]}" pe_start 768.00k
# Kernel (3.19) could provide wrong results - in this case skip
# test with incorrect result - lvm2 can't figure out good values.
MINOR=$(stat -c %T "$dev1")
check sysfs_queue "dm-$MINOR" optimal_io_size 786432 || SHOULD=should
$SHOULD check pv_field "${DEVICES[@]}" pe_start 768.00k
aux cleanup_scsi_debug_dev aux cleanup_scsi_debug_dev