autotest_common: pass optional arguments to discover_bdevs
Allow passing additional args to discover_bdevs function,
primarily for use in bdev_svc app.
This is needed mostly in case of virtio tests when host
uses 2MB huge pages - "-g" option is then needed to run
SPDK app.
Need to make timeout value hardcoded while at it.
Can't have 2 optional positional arguments. Timeout as
an option is never used so this shouldn't be a problem.
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2021/4 (master)
This patch is a bit different than it's merged version in
master branch (a3e5b5d0ec
).
This was done to allow running virtio tests with 2MB
hugepages.
(cherry-picked from 387fe9f44d80411013dada4f6d73fc49505bfaed)
Change-Id: I2a455f9d23fafbf0746423f69379b74939ac2e9c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2104
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
c2e522ec9e
commit
f7f016d5ef
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user