autotest: detect if nbd module is available

Some distributions may not ship the nbd module; detect whether it can be
loaded rather than just failing if it is missing.

Change-Id: Ib35ba26b211de4e8b85b689ab55fed47bd02a750
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/398097
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2018-02-01 11:36:49 -07:00
parent fc7e847539
commit 4716d5aabb

View File

@ -366,7 +366,7 @@ function print_backtrace() {
}
function part_dev_by_gpt () {
if [ $(uname -s) = Linux ] && hash sgdisk; then
if [ $(uname -s) = Linux ] && hash sgdisk && modprobe nbd; then
conf=$1
devname=$2
rootdir=$3
@ -386,7 +386,6 @@ function part_dev_by_gpt () {
echo "[Gpt]" >> ${conf}.gpt
echo " Disable Yes" >> ${conf}.gpt
modprobe nbd
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -c ${conf}.gpt &
nbd_pid=$!
echo "Process nbd pid: $nbd_pid"