Spdk/test/nvmf/target/nvmf_vhost.sh
paul luse eb53c23236 add (c) and SPDX header to bash files as needed
per Intel policy to include file commit date using git cmd
below.  The policy does not apply to non-Intel (C) notices.

git log --follow -C90% --format=%ad --date default <file> | tail -1

and then pull just the year from the result.

Intel copyrights were not added to files where Intel either had
no contribution ot the contribution lacked substance (ie license
header updates, formatting changes, etc)

For intel copyrights added, --follow and -C95% were used.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2ef86976095b88a9bf5b1003e59f3943cd6bbe4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15209
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-11-29 08:27:51 +00:00

69 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2019 Intel Corporation
# All rights reserved.
#
testdir=$(readlink -f $(dirname $0))
rootdir=$testdir/../../..
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
source $rootdir/test/vhost/common.sh
MALLOC_BDEV_SIZE=128
MALLOC_BLOCK_SIZE=512
NVMF_SOCK="/tmp/nvmf_rpc.sock"
NVMF_RPC="$rootdir/scripts/rpc.py -s $NVMF_SOCK"
VHOST_SOCK="/tmp/vhost_rpc.sock"
VHOST_APP+=(-p 0 -r "$VHOST_SOCK" -u)
VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK"
vhosttestinit
nvmftestinit
# Start Apps
"${NVMF_APP[@]}" -r $NVMF_SOCK -m 0x1 &
nvmfpid=$!
waitforlisten $nvmfpid $NVMF_SOCK
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
mkdir -p "$(get_vhost_dir 3)"
"${VHOST_APP[@]}" -S "$(get_vhost_dir 3)" -m 0x2 &
vhostpid=$!
waitforlisten $vhostpid $NVMF_SOCK
trap 'process_shm --id $NVMF_APP_SHM_ID; killprocess $vhostpid nvmftestfini; exit 1' SIGINT SIGTERM EXIT
# Configure NVMF tgt on host machine
malloc_bdev="$($NVMF_RPC bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
$NVMF_RPC nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
$NVMF_RPC nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
$NVMF_RPC nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 "$malloc_bdev"
$NVMF_RPC nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
# Configure VHost on host machine
$VHOST_RPC bdev_nvme_attach_controller -b Nvme0 -t $TEST_TRANSPORT -f ipv4 -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
$VHOST_RPC vhost_create_scsi_controller naa.VhostScsi0.3
$VHOST_RPC vhost_scsi_controller_add_target naa.VhostScsi0.3 0 "Nvme0n1"
# start qemu based VM.
vm_setup --os="$VM_IMAGE" --disk-type=spdk_vhost_scsi --disks="VhostScsi0" --force=3 --vhost-name=3
vm_run 3
vm_wait_for_boot 300 3
# Run the fio workload remotely
vm_scp 3 $testdir/nvmf_vhost_fio.job 127.0.0.1:/root/nvmf_vhost_fio.job
vm_exec 3 "fio /root/nvmf_vhost_fio.job"
vm_shutdown_all
trap - SIGINT SIGTERM EXIT
killprocess $vhostpid
nvmftestfini