diff --git a/test/spdkcli/common.sh b/test/spdkcli/common.sh index aa54110fc..263d96bf9 100644 --- a/test/spdkcli/common.sh +++ b/test/spdkcli/common.sh @@ -45,3 +45,7 @@ function check_match() { $rootdir/test/app/match/match $testdir/match_files/${MATCH_FILE}.match rm -f $testdir/match_files/${MATCH_FILE} } + +function wait_for_all_nvme_ctrls_to_detach() { + while (($(rpc_cmd bdev_nvme_get_controllers | jq '.|length') != 0)); do :; done +} diff --git a/test/spdkcli/vhost.sh b/test/spdkcli/vhost.sh index 5507a9e6f..5901916ea 100755 --- a/test/spdkcli/vhost.sh +++ b/test/spdkcli/vhost.sh @@ -131,8 +131,11 @@ $spdkcli_job "'load_config $testdir/config.json' " check_match $spdk_clear_config_py clear_config -# FIXME: remove this sleep when NVMe driver will be fixed to wait for reset to complete -sleep 2 + +# Make sure we wait long enough for the nvme ctrl to disappear, otherwise +# we are at risk of hitting -EPERM while loading bdev configuration. +xtrace_disable_per_cmd wait_for_all_nvme_ctrls_to_detach + $spdkcli_job "'load_subsystem_config $testdir/config_bdev.json' 'load_subsystem_config $testdir/config_vhost_scsi.json' 'load_subsystem_config $testdir/config_vhost_blk.json'