#
# This script is used to test large size LUN support in Lustre.
#
-################################################################################
+
set -e
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
init_logging
+ALWAYS_EXCEPT="$LARGE_LUN_EXCEPT"
+build_test_filter
+
if [ "$REFORMAT" != "yes" ]; then
skip_env "$0 reformats all devices,\
please set REFORMAT to run this test"
# Variable to run mdsrate
THREADS_PER_CLIENT=${THREADS_PER_CLIENT:-5} # thread(s) per client node
-MACHINEFILE=${MACHINEFILE:-$TMP/$TESTSUITE.machines}
NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
-# bug number:
-ALWAYS_EXCEPT="$LARGE_LUN_EXCEPT"
-
-build_test_filter
LARGE_LUN_RESTORE_MOUNT=false
if is_mounted $MOUNT || is_mounted $MOUNT2; then
LARGE_LUN_RESTORE_MOUNT=true
ldiskfs )
cmd="$DUMPE2FS -h $dev" ;;
zfs )
- cmd="$ZDB -l $(facet_vdevice $facet)" ;;
+ cmd="$ZDB -l $(zpool_name $facet)" ;;
* )
error "unknown fstype!" ;;
esac
local dev
local ostmnt
local fstype
+ local zostsize_restore=${OSTSIZE}
+ local zmin=$((30 << 30)) # 30GiB in bytes
+ local skipped=1
+
+ stack_trap "export OSTSIZE=$zostsize_restore" EXIT
for num in $(seq $OSTCOUNT); do
dev=$(ostdevname $num)
ostmnt=$(facet_mntpt ost${num})
fstype=$(facet_fstype ost${num})
- # Mount the OST as an ldiskfs filesystem.
+ if [[ $fstype == "zfs" ]] && [[ ${OSTSIZE} -lt ${zmin} ]]; then
+ local real_dev=$(ostvdevname $num)
+ local num_sectors=$(get_num_sectors $facet $real_dev)
+ local phy_bytes=$((num_sectors * 512))
+
+ if [ ${phy_bytes} -lt ${zmin} ] ; then
+ log "ost${num}: OSTSIZE ${OSTSIZE} less than 30GiB"
+ log "ost${num}: Block device ${phy_bytes} too small"
+ log " .. skipping this ost"
+ continue
+ fi
+ # Backing block device is big enough
+ skipped=0
+ log "ost${num}: OSTSIZE ${OSTSIZE} too small, increasing to 30GiB [temporarily]"
+ format_ost ${num}
+ # NOTE: OSTSIZE is in KB
+ export OSTSIZE=$((zmin >> 10))
+ fi
+
+ # Mount the OST as an ldiskfs or zfs filesystem.
log "mount the OST $dev as a $fstype filesystem"
add ost${num} $(mkfs_opts ost${num} $dev) $FSTYPE_OPT \
--reformat $(ostdevname $num) \
error "format ost${num} error"
if [ $fstype == zfs ]; then
import_zpool ost${num}
- do_facet ost${num} "$ZFS set canmount=on $dev; " \
- "$ZFS set mountpoint=legacy $dev; $ZFS list $dev"
+ do_facet ost${num} \
+ "$ZFS set canmount=on $dev; " \
+ "$ZFS set mountpoint=legacy $dev; " \
+ "$ZFS list $dev"
fi
run_dumpfs ost${num} $dev
do_facet ost${num} mount -t $fstype $dev \
$ostmnt "$OST_MOUNT_OPTS"
- # Run llverfs on the mounted ldiskfs filesystem in partial mode
+ # Run llverfs on the mounted filesystem in partial mode
# to ensure that the kernel can perform filesystem operations
# on the complete device without any errors.
log "run llverfs in partial mode on the OST $fstype $ostmnt"
log "unmount the OST $dev"
stop ost${num}
- # After llverfs is run on the ldiskfs filesystem in partial
+ # After llverfs is run on the filesystem in partial
# mode, a full e2fsck should be run to catch any errors early.
$RUN_FSCK && check_fsfacet ost${num}
# errors early.
$RUN_FSCK && check_fsfacet ost${num}
fi
+ export OSTSIZE=${zostsize_restore}
done
+ [[ $skipped -ne 0 ]] && skip_env "No OST with enough space is available."
# there is no reason to continue using ost devices
# filled by llverfs as ldiskfs
formatall