Commit b2e6e62a authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

test/spdkcli: Wait long enough for the nvme ctrl to be gone



Some nvmes need more time to attach|detach to|from, hence having a
static sleep is not ideal depending on what type of the nvme was
picked up for the test. Instead, simply wait until the list of
nvme ctrls is empty after the cleanup.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17559

 (master)

(cherry picked from commit 162bf435)
Change-Id: I2fc2630020436d0e1f6b01a5ce60aea56e7bf8ec
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17723


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 8ecf58ac
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -48,3 +48,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
}
+5 −2
Original line number Diff line number Diff line
@@ -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'