[WIP] avocado-vt: add support for virtio-blk-vhost-user
add the following parameters in test case: vm_mem_backend = memory-backend-memfd vm_mem_share = yes vhost_user_blk_images = "stg1" images += " ${vhost_user_blk_images}" image_format_stg1 = raw image_raw_device_stg1 = yes drive_format_stg1 = virtio #drive_format_stg1 = scsi-hd storage_type_stg1 = "vhost-user-blk" remove_image_stg1 = no force_create_image_stg1 = no create_image_stg1 = no check_image_stg1 = no drv_extra_params_stg1 += ",cache.direct=on" image_name_stg1 = "/tmp/vhost-user-blk1.sock"
The results were passed. (1/1) Host_RHEL.m9.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.10.0.x86_64.io-github-autotest-qemu.boot.q35: PASS (35.90 s) (1/1) Host_RHEL.m9.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.x86_64.io-github-autotest-qemu.boot.q35: PASS (97.76 s)
qemu command lines:
-blockdev driver=virtio-blk-vhost-user,node-name=vhost-user-file,path=/tmp/vhost-user-blk1.sock
-blockdev driver=raw,node-name=fmt-vhost-user,file=vhost-user-file
-device virtio-blk-pci,drive=fmt-vhost-user,id=blk2,bus=pcie-root-port-3
@YongxueHong @zhencliu As we discussed, I updated the codes and the test passed. Can you help review it again? Many thanks.
Because this check “fedora_35 AVOCADO_SRC: SETUP:-m pip install . VT_TYPE:libvirtQueued” has been in the queue all along, I re-push it. All checks have passed.
Test passed, get the expected qemu command lines. (1/1) Host_RHEL.m9.u5.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.10.0.x86_64.io-github-autotest-qemu.boot.q35: PASS (36.16 s)
@YongxueHong Updated, Could you please take another look at this? Many thanks.
Hi @XueqiangWei The code looks good to me. Could you help run it with the latest version for a regression test? And pls help paste the related command line from a normal test case log.
Hi @zhencliu @aliang123 Pls help review it again? Since some update with it. Thanks.
Because this check "Cirrus CI / fedora_35 AVOCADO_SRC:avocado-framework<93.0 SETUP:-m pip install . VT_TYPE:qemu" has been in the queue all along, I re-push it. All checks have passed.
@YongxueHong I tested it on the latest rhel9 and rhel10, both work as expected. the qemu command lines as below. Many thanks.
drive_format_stg1 = virtio
-blockdev '{"node-name": "drive_stg1", "driver": "virtio-blk-vhost-user", "read-only": false, "discard": "unmap", "path": "/tmp/vhost-user-blk1.sock", "cache": {"direct": true, "no-flush": false}}' \
-device '{"id": "pcie-root-port-3", "port": 3, "driver": "pcie-root-port", "addr": "0x1.0x3", "bus": "pcie.0", "chassis": 4}' \
-device '{"driver": "virtio-blk-pci", "id": "stg1", "drive": "drive_stg1", "write-cache": "on", "bus": "pcie-root-port-3", "addr": "0x0"}' \
drive_format_stg1 = scsi-hd
-blockdev '{"node-name": "drive_stg1", "driver": "virtio-blk-vhost-user", "read-only": false, "discard": "unmap", "path": "/tmp/vhost-user-blk1.sock", "cache": {"direct": true, "no-flush": false}}' \
-device '{"driver": "scsi-hd", "id": "stg1", "drive": "drive_stg1", "write-cache": "on"}' \
Acked by: Aihua Liang QSD: [stdlog] 2025-07-03 06:02:43,212 avocado.virttest.qemu_devices.qdevices qdevices L1917 INFO | Running QSD daemon command /usr/bin/qemu-storage-daemon --chardev socket,server=on,wait=off,path=/root/avocado/data/avocado-vt/qsd/qsd1/qsd1_monitor.sock,id=qsd_monitor_qsd1 --monitor chardev=qsd_monitor_qsd1,mode=control --blockdev '{"driver": "file", "node-name": "prot_stg1", "filename": "/home/kvm_autotest_root/images/stg1.qcow2", "auto-read-only": true, "discard": "unmap"}' --blockdev '{"driver": "qcow2", "node-name": "fmt_stg1", "file": "prot_stg1", "read-only": false, "detect-zeroes": "unmap", "discard": "unmap"}' --export '{"type": "vhost-user-blk", "id": "id_stg1", "node-name": "fmt_stg1", "writable": true, "addr": {"type": "unix", "path": "/root/avocado/data/avocado-vt/qsd/qsd1/qsd1_vhost_user_stg1.sock"}}' --pidfile /root/avocado/data/avocado-vt/qsd/qsd1/qsd1.pid
start VM with the QSD export image:
[stdlog] -blockdev '{"node-name": "drive_data1", "driver": "virtio-blk-vhost-user", "read-only": false, "discard": "unmap", "path": "/root/avocado/data/avocado-vt/qsd/qsd1/qsd1_vhost_user_stg1.sock", "cache": {"direct": true, "no-flush": false}}'
[stdlog] -device '{"driver": "scsi-hd", "id": "data1", "drive": "drive_data1", "write-cache": "on"}' \