Spdk/test/vfio_user/nvme/common.sh
Michal Berger 588dfe314b Add SPDX header to various files
They were missed by the initial set of patches which introduced this
header as a mandatory one across different types of files.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I3f9b37d41298c843e1648e72fe8593768ccd37e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15423
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-11-29 08:27:51 +00:00

37 lines
827 B
Bash

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2022 Intel Corporation.
# All rights reserved.
function clean_vfio_user() {
trap - ERR
print_backtrace
set +e
error "Error on $1 $2"
vm_kill_all
vhost_kill 0
exit 1
}
function vfio_user_run() {
local vhost_name=$1
local vfio_user_dir nvmf_pid_file rpc_py
vfio_user_dir=$(get_vhost_dir $vhost_name)
nvmf_pid_file="$vfio_user_dir/vhost.pid"
rpc_py="$rootdir/scripts/rpc.py -s $vfio_user_dir/rpc.sock"
mkdir -p $vfio_user_dir
timing_enter vfio_user_start
$rootdir/build/bin/nvmf_tgt -r $vfio_user_dir/rpc.sock -m 0xf &
nvmfpid=$!
echo $nvmfpid > $nvmf_pid_file
echo "Process pid: $nvmfpid"
echo "waiting for app to run..."
waitforlisten $nvmfpid $vfio_user_dir/rpc.sock
$rpc_py nvmf_create_transport -t VFIOUSER
timing_exit vfio_user_start
}