test/common: remove discover_bdevs()

There were many cases in the past where discover_bdevs()
is the first app to parse given (invalid) config and silently
fail without even printing the exact error. That's because
the spdk app that's started inside that function has &>/dev/null.

discover_bdevs() is currently used only in nvme perf scripts,
so move it there. It should be probably simplified there,
but the priority for now - and the purpose of this patch - is to
remove it from autotest_common.sh so that no one is tempted to use it.

Change-Id: I1d5840dde9272cdaa1ff282022c6ec29a297df50
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1554
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Darek Stojaczyk 2020-03-27 17:18:28 +01:00 committed by Tomasz Zawadzki
parent 8c007d46fc
commit 4c6a9cdfa4
2 changed files with 36 additions and 36 deletions

View File

@ -936,42 +936,6 @@ function print_backtrace() {
return 0
}
function discover_bdevs() {
local rootdir=$1
local config_file=$2
local cfg_type=$3
local wait_for_spdk_bdev=${4:-30}
local rpc_server=/var/tmp/spdk-discover-bdevs.sock
if [ ! -e $config_file ]; then
echo "Invalid Configuration File: $config_file"
return 1
fi
if [ -z $cfg_type ]; then
cfg_type="-c"
fi
# Start the bdev service to query for the list of available
# bdevs.
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 \
$cfg_type $config_file &> /dev/null &
stubpid=$!
while ! [ -e /var/run/spdk_bdev0 ]; do
# If this counter drops to zero, errexit will be caught to abort the test
((wait_for_spdk_bdev--))
sleep 1
done
# Get all of the bdevs
$rootdir/scripts/rpc.py -s "$rpc_server" bdev_get_bdevs
# Shut down the bdev service
kill $stubpid
wait $stubpid
rm -f /var/run/spdk_bdev0
}
function waitforserial() {
local i=0
local nvme_device_counter=1

View File

@ -36,6 +36,42 @@ PRECONDITIONING=true
ONEWORKLOAD=false
DATE="$(date +'%m_%d_%Y_%H%M%S')"
function discover_bdevs() {
local rootdir=$1
local config_file=$2
local cfg_type=$3
local wait_for_spdk_bdev=${4:-30}
local rpc_server=/var/tmp/spdk-discover-bdevs.sock
if [ ! -e $config_file ]; then
echo "Invalid Configuration File: $config_file"
return 1
fi
if [ -z $cfg_type ]; then
cfg_type="-c"
fi
# Start the bdev service to query for the list of available
# bdevs.
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 \
$cfg_type $config_file &> /dev/null &
stubpid=$!
while ! [ -e /var/run/spdk_bdev0 ]; do
# If this counter drops to zero, errexit will be caught to abort the test
((wait_for_spdk_bdev--))
sleep 1
done
# Get all of the bdevs
$rootdir/scripts/rpc.py -s "$rpc_server" bdev_get_bdevs
# Shut down the bdev service
kill $stubpid
wait $stubpid
rm -f /var/run/spdk_bdev0
}
function is_bdf_not_mounted() {
local bdf=$1
local blkname