From 50656e7a078ea870050f8821a1a6c56f7a1f512f Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 26 Nov 2018 01:04:25 -0700 Subject: [PATCH] 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 Change-Id: I3597ff1f7ac53162c33a0384a33f33776cf6f182 Reviewed-on: https://review.gerrithub.io/434838 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk --- autotest.sh | 4 ++++ test/bdev/nbdjson/json_config.sh | 1 - test/lvol/lvol.sh | 1 - test/vhost/vhost_boot/vhost_boot.sh | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/autotest.sh b/autotest.sh index 3a7cce26a..a064a3468 100755 --- a/autotest.sh +++ b/autotest.sh @@ -14,6 +14,10 @@ fi if [ $(uname -s) = Linux ]; then # set core_pattern to a known value to avoid ABRT, systemd-coredump, etc. 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 trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT diff --git a/test/bdev/nbdjson/json_config.sh b/test/bdev/nbdjson/json_config.sh index ed4a06e89..062d12038 100755 --- a/test/bdev/nbdjson/json_config.sh +++ b/test/bdev/nbdjson/json_config.sh @@ -25,6 +25,5 @@ timing_exit nbd_json_config_test $clear_config_py clear_config kill_targets -rmmod nbd timing_exit nbd_json_config report_test_completion nbd_json_config diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index 29e3f0ff9..9724d0cb5 100755 --- a/test/lvol/lvol.sh +++ b/test/lvol/lvol.sh @@ -122,7 +122,6 @@ function vhost_kill() sleep 1 fi 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 diff --git a/test/vhost/vhost_boot/vhost_boot.sh b/test/vhost/vhost_boot/vhost_boot.sh index 79bfd81df..4ec480afd 100755 --- a/test/vhost/vhost_boot/vhost_boot.sh +++ b/test/vhost/vhost_boot/vhost_boot.sh @@ -68,13 +68,12 @@ timing_exit create_lvol timing_enter convert_vm_image 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 $QEMU_PREFIX/bin/qemu-img convert $os_image -O raw /dev/nbd0 sync nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0 sleep 1 -rmmod nbd timing_exit convert_vm_image trap 'err_clean "${FUNCNAME}" "${LINENO}"' ERR