diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 165531bec1..19dccd9126 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -827,7 +827,9 @@ function discover_bdevs() local rootdir=$1 local config_file=$2 local cfg_type=$3 - local wait_for_spdk_bdev=${4:-30} + shift 3 + local bdev_svc_opts=("$@") + local wait_for_spdk_bdev=30 local rpc_server=/var/tmp/spdk-discover-bdevs.sock if [ ! -e $config_file ]; then @@ -841,7 +843,7 @@ function discover_bdevs() # Start the bdev service to query for the list of available # bdevs. - $rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 \ + $rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 "${bdev_svc_opts[@]}" \ $cfg_type $config_file &>/dev/null & stubpid=$! while ! [ -e /var/run/spdk_bdev0 ]; do diff --git a/test/vhost/initiator/blockdev.sh b/test/vhost/initiator/blockdev.sh index 5ed02f502a..eecba973f2 100755 --- a/test/vhost/initiator/blockdev.sh +++ b/test/vhost/initiator/blockdev.sh @@ -58,6 +58,7 @@ function run_spdk_fio() { function create_bdev_config() { local vbdevs + local g_opt if [ -z "$($RPC_PY bdev_get_bdevs | jq '.[] | select(.name=="Nvme0n1")')" ]; then error "Nvme0n1 bdev not found!" @@ -82,7 +83,13 @@ function create_bdev_config() $RPC_PY vhost_create_scsi_controller naa.Malloc1.0 $RPC_PY vhost_scsi_controller_add_target naa.Malloc1.0 0 Malloc1 - vbdevs=$(discover_bdevs $rootdir $testdir/bdev.json "--json") + # Check default size of host hugepages. If it's 2MB then we have to use + # bdev_svc "-g" option for virtio devices. + if (( $(grep "Hugepagesize" /proc/meminfo | grep -Eo "[[:digit:]]+") == 2048 )); then + g_opt="-g" + fi + + vbdevs=$(discover_bdevs $rootdir $testdir/bdev.json "--json" $g_opt) virtio_bdevs=$(jq -r '[.[].name] | join(":")' <<< $vbdevs) virtio_with_unmap=$(jq -r '[.[] | select(.supported_io_types.unmap==true).name] | join(":")' <<< $vbdevs)