test: modprobe nbd at the start of autotest

This helps avoid issues with nbd not being ready when
we need it.

Still keep various "modprobe nbd" in different test
files - this ensures these test files can still be
run in isolation.  But remove the various "rmmod nbd"
to ensure that nbd always stays loaded.  There is no
harm in just keeping nbd loaded all the time.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3597ff1f7ac53162c33a0384a33f33776cf6f182

Reviewed-on: https://review.gerrithub.io/434838
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Jim Harris 2018-11-26 01:04:25 -07:00
parent 2f5feaf5b1
commit 50656e7a07
4 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,10 @@ fi
if [ $(uname -s) = Linux ]; then if [ $(uname -s) = Linux ]; then
# set core_pattern to a known value to avoid ABRT, systemd-coredump, etc. # set core_pattern to a known value to avoid ABRT, systemd-coredump, etc.
echo "core" > /proc/sys/kernel/core_pattern echo "core" > /proc/sys/kernel/core_pattern
# make sure nbd (network block device) driver is loaded if it is available
# this ensures that when tests need to use nbd, it will be fully initialized
modprobe nbd || true
fi fi
trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT

View File

@ -25,6 +25,5 @@ timing_exit nbd_json_config_test
$clear_config_py clear_config $clear_config_py clear_config
kill_targets kill_targets
rmmod nbd
timing_exit nbd_json_config timing_exit nbd_json_config
report_test_completion nbd_json_config report_test_completion nbd_json_config

View File

@ -122,7 +122,6 @@ function vhost_kill()
sleep 1 sleep 1
fi fi
rm $BASE_DIR/vhost.pid || true rm $BASE_DIR/vhost.pid || true
rmmod nbd || true
} }
trap "vhost_kill; rm -f $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1; exit 1" SIGINT SIGTERM EXIT trap "vhost_kill; rm -f $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1; exit 1" SIGINT SIGTERM EXIT

View File

@ -68,13 +68,12 @@ timing_exit create_lvol
timing_enter convert_vm_image timing_enter convert_vm_image
modprobe nbd modprobe nbd
trap 'nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0; rmmod nbd; err_clean "${FUNCNAME}" "${LINENO}"' ERR trap 'nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0; err_clean "${FUNCNAME}" "${LINENO}"' ERR
nbd_start_disks "$(get_vhost_dir)/rpc.sock" $lvb_u /dev/nbd0 nbd_start_disks "$(get_vhost_dir)/rpc.sock" $lvb_u /dev/nbd0
$QEMU_PREFIX/bin/qemu-img convert $os_image -O raw /dev/nbd0 $QEMU_PREFIX/bin/qemu-img convert $os_image -O raw /dev/nbd0
sync sync
nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0 nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0
sleep 1 sleep 1
rmmod nbd
timing_exit convert_vm_image timing_exit convert_vm_image
trap 'err_clean "${FUNCNAME}" "${LINENO}"' ERR trap 'err_clean "${FUNCNAME}" "${LINENO}"' ERR