Revert "test/vhost/initiator: Don't use spdk_tgt to generate json config"
This reverts commit 0c30154eb5
.
Make a change in the revert to pre-allocate 1GB of memory for the
spdk_tgt initiator process, which is required for the virtio
initiator.
Fixes issue #2596.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id594fa1ccb2daf535b1aaaef0a397bda2ec98579
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13828
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
c527d09f30
commit
8216e70a14
@ -10,47 +10,11 @@ function run_spdk_fio() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function err_cleanup() {
|
function err_cleanup() {
|
||||||
|
rm -f $testdir/bdev.json
|
||||||
killprocess $vhost_pid
|
killprocess $vhost_pid
|
||||||
}
|
if [[ -n "$dummy_spdk_pid" ]] && kill -0 $dummy_spdk_pid &> /dev/null; then
|
||||||
|
killprocess $dummy_spdk_pid
|
||||||
function gen_vhost_conf() {
|
fi
|
||||||
local traddr dev_type vg_count name conf setup
|
|
||||||
|
|
||||||
setup+=("naa.Nvme0n1_scsi0.0 scsi 8 VirtioScsi0")
|
|
||||||
setup+=("naa.Nvme0n1_blk0.0 blk 8 VirtioBlk3")
|
|
||||||
setup+=("naa.Nvme0n1_blk1.0 blk 8 VirtioBlk4")
|
|
||||||
setup+=("naa.Malloc0.0 scsi 8 VirtioScsi1")
|
|
||||||
setup+=("naa.Malloc1.0 scsi 8 VirtioScsi2")
|
|
||||||
|
|
||||||
while read -r traddr dev_type vg_count name; do
|
|
||||||
conf+=("$(
|
|
||||||
cat <<- VHOST
|
|
||||||
{
|
|
||||||
"method": "bdev_virtio_attach_controller",
|
|
||||||
"params": {
|
|
||||||
"name": "$name",
|
|
||||||
"dev_type": "$dev_type",
|
|
||||||
"trtype": "user",
|
|
||||||
"traddr": "$traddr",
|
|
||||||
"vq_count": $vg_count,
|
|
||||||
"vq_size": 512
|
|
||||||
}
|
|
||||||
}
|
|
||||||
VHOST
|
|
||||||
)")
|
|
||||||
done < <(printf '%s\n' "${setup[@]}")
|
|
||||||
|
|
||||||
local IFS=","
|
|
||||||
cat <<- VHOST
|
|
||||||
{
|
|
||||||
"subsystems": [ {
|
|
||||||
"subsystem": "bdev",
|
|
||||||
"config": [
|
|
||||||
${conf[*]}
|
|
||||||
]
|
|
||||||
} ]
|
|
||||||
}
|
|
||||||
VHOST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# start vhost and configure it
|
# start vhost and configure it
|
||||||
@ -88,16 +52,37 @@ rpc_cmd vhost_create_scsi_controller naa.Malloc1.0 --cpumask 0xc
|
|||||||
rpc_cmd vhost_scsi_controller_add_target naa.Malloc1.0 0 Malloc1
|
rpc_cmd vhost_scsi_controller_add_target naa.Malloc1.0 0 Malloc1
|
||||||
[[ "$(rpc_cmd vhost_get_controllers -n naa.Malloc1.0 | jq -r '.[].cpumask')" == "0xc" ]]
|
[[ "$(rpc_cmd vhost_get_controllers -n naa.Malloc1.0 | jq -r '.[].cpumask')" == "0xc" ]]
|
||||||
|
|
||||||
|
# start a dummy app, create vhost bdevs in it, then dump the config for FIO
|
||||||
|
# Pre-allocate 1GB of memory for the application - virtio-user initiator requires it. See issue #2596.
|
||||||
|
$SPDK_BIN_DIR/spdk_tgt -r /tmp/spdk2.sock -g -s 1024 &
|
||||||
|
dummy_spdk_pid=$!
|
||||||
|
waitforlisten $dummy_spdk_pid /tmp/spdk2.sock
|
||||||
|
rpc_cmd -s /tmp/spdk2.sock bdev_virtio_attach_controller --trtype user --traddr 'naa.Nvme0n1_scsi0.0' -d scsi --vq-count 8 'VirtioScsi0'
|
||||||
|
rpc_cmd -s /tmp/spdk2.sock bdev_virtio_attach_controller --trtype user --traddr 'naa.Nvme0n1_blk0.0' -d blk --vq-count 8 'VirtioBlk3'
|
||||||
|
rpc_cmd -s /tmp/spdk2.sock bdev_virtio_attach_controller --trtype user --traddr 'naa.Nvme0n1_blk1.0' -d blk --vq-count 8 'VirtioBlk4'
|
||||||
|
|
||||||
|
rpc_cmd -s /tmp/spdk2.sock bdev_virtio_attach_controller --trtype user --traddr 'naa.Malloc0.0' -d scsi --vq-count 8 'VirtioScsi1'
|
||||||
|
rpc_cmd -s /tmp/spdk2.sock bdev_virtio_attach_controller --trtype user --traddr 'naa.Malloc1.0' -d scsi --vq-count 8 'VirtioScsi2'
|
||||||
|
|
||||||
|
cat <<- CONF > $testdir/bdev.json
|
||||||
|
{"subsystems":[
|
||||||
|
$(rpc_cmd -s /tmp/spdk2.sock save_subsystem_config -n bdev)
|
||||||
|
]}
|
||||||
|
CONF
|
||||||
|
killprocess $dummy_spdk_pid
|
||||||
|
|
||||||
|
# run FIO with previously acquired spdk config files
|
||||||
timing_enter run_spdk_fio
|
timing_enter run_spdk_fio
|
||||||
run_spdk_fio $testdir/bdev.fio --filename=* --section=job_randwrite --spdk_json_conf=<(gen_vhost_conf)
|
run_spdk_fio $testdir/bdev.fio --filename=* --section=job_randwrite --spdk_json_conf=$testdir/bdev.json
|
||||||
timing_exit run_spdk_fio
|
timing_exit run_spdk_fio
|
||||||
|
|
||||||
timing_enter run_spdk_fio_unmap
|
timing_enter run_spdk_fio_unmap
|
||||||
run_spdk_fio $testdir/bdev.fio --filename="VirtioScsi1t0:VirtioScsi2t0" --spdk_json_conf=<(gen_vhost_conf)
|
run_spdk_fio $testdir/bdev.fio --filename="VirtioScsi1t0:VirtioScsi2t0" --spdk_json_conf=$testdir/bdev.json
|
||||||
timing_exit run_spdk_fio_unmap
|
timing_exit run_spdk_fio_unmap
|
||||||
|
|
||||||
rpc_cmd bdev_nvme_detach_controller Nvme0
|
rpc_cmd bdev_nvme_detach_controller Nvme0
|
||||||
|
|
||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
|
rm -f $testdir/bdev.json
|
||||||
|
|
||||||
killprocess $vhost_pid
|
killprocess $vhost_pid
|
||||||
|
Loading…
Reference in New Issue
Block a user