test/vhost/initiator: Don't use spdk_tgt to generate json config
This is done in order to mitigate the following issue: https://github.com/spdk/spdk/issues/2596 which has been frequently breaking CI. Since failure occurs while trying to terminate spdk_tgt, remove it from the equation completely. Signed-off-by: Michal Berger <michal.berger@intel.com> Change-Id: I9eb2423079ec0717b9b094ccb372adabac614463 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13802 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
83a4b155ca
commit
0c30154eb5
@ -10,11 +10,47 @@ function run_spdk_fio() {
|
||||
}
|
||||
|
||||
function err_cleanup() {
|
||||
rm -f $testdir/bdev.json
|
||||
killprocess $vhost_pid
|
||||
if [[ -n "$dummy_spdk_pid" ]] && kill -0 $dummy_spdk_pid &> /dev/null; then
|
||||
killprocess $dummy_spdk_pid
|
||||
fi
|
||||
}
|
||||
|
||||
function gen_vhost_conf() {
|
||||
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
|
||||
@ -52,36 +88,16 @@ 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_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
|
||||
$SPDK_BIN_DIR/spdk_tgt -r /tmp/spdk2.sock -g &
|
||||
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
|
||||
run_spdk_fio $testdir/bdev.fio --filename=* --section=job_randwrite --spdk_json_conf=$testdir/bdev.json
|
||||
run_spdk_fio $testdir/bdev.fio --filename=* --section=job_randwrite --spdk_json_conf=<(gen_vhost_conf)
|
||||
timing_exit run_spdk_fio
|
||||
|
||||
timing_enter run_spdk_fio_unmap
|
||||
run_spdk_fio $testdir/bdev.fio --filename="VirtioScsi1t0:VirtioScsi2t0" --spdk_json_conf=$testdir/bdev.json
|
||||
run_spdk_fio $testdir/bdev.fio --filename="VirtioScsi1t0:VirtioScsi2t0" --spdk_json_conf=<(gen_vhost_conf)
|
||||
timing_exit run_spdk_fio_unmap
|
||||
|
||||
rpc_cmd bdev_nvme_detach_controller Nvme0
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
rm -f $testdir/bdev.json
|
||||
|
||||
killprocess $vhost_pid
|
||||
|
Loading…
Reference in New Issue
Block a user