1 # Copyright (C) 2010 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
11 which mkfs.ext3 || exit 200
13 # Get linux minor version
14 linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1)
16 test $linux_minor -ge 31 || exit 200
20 check_logical_block_size()
24 # Verify logical_block_size - requires Linux >= 2.6.31
25 SYSFS_LOGICAL_BLOCK_SIZE=`echo /sys/block/$(basename $DEV_)/queue/logical_block_size`
26 if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then
27 ACTUAL_LOGICAL_BLOCK_SIZE=`cat $SYSFS_LOGICAL_BLOCK_SIZE`
28 test $ACTUAL_LOGICAL_BLOCK_SIZE = $LOGICAL_BS
34 echo "$DM_DEV_DIR/$1/$2"
39 lvcreate -L 16M -n $lv1 $vg $dev1
40 mkfs.ext3 $(lvdev_ $vg $lv1)
42 mount $(lvdev_ $vg $lv1) test_mnt
43 lvcreate -L 16M -n $lv2 -s $vg/$lv1
46 mount $(lvdev_ $vg $lv1) test_mnt
49 mount $(lvdev_ $vg $lv2) test_mnt
57 # FIXME add more topology-specific tests and validation (striped LVs, etc)
61 DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
63 # ---------------------------------------------
64 # Create "desktop-class" 4K drive
65 # (logical_block_size=512, physical_block_size=4096, alignment_offset=0):
66 LOGICAL_BLOCK_SIZE=512
67 prepare_scsi_debug_dev $DEV_SIZE \
68 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
69 check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
71 aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
72 vgcreate -c n $vg $devs
76 cleanup_scsi_debug_dev
78 # ---------------------------------------------
79 # Create "desktop-class" 4K drive w/ 63-sector DOS partition compensation
80 # (logical_block_size=512, physical_block_size=4096, alignment_offset=3584):
81 LOGICAL_BLOCK_SIZE=512
82 prepare_scsi_debug_dev $DEV_SIZE \
83 sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
84 check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
86 aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
87 vgcreate -c n $vg $devs
91 cleanup_scsi_debug_dev
93 # ---------------------------------------------
94 # Create "enterprise-class" 4K drive
95 # (logical_block_size=4096, physical_block_size=4096, alignment_offset=0):
96 LOGICAL_BLOCK_SIZE=4096
97 prepare_scsi_debug_dev $DEV_SIZE \
98 sector_size=$LOGICAL_BLOCK_SIZE
99 check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
101 aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
102 vgcreate -c n $vg $devs