On Wed, Aug 2, 2023 at 10:33 PM Jonathon Jongsma <jjongsma(a)redhat.com> wrote:
On 7/24/23 8:05 AM, Peter Krempa wrote:
[...]
>
> I've also noticed that using 'qcow2' format for the device doesn't
work:
>
> error: internal error: process exited while connecting to monitor:
2023-07-24T12:54:15.818631Z qemu-system-x86_64: -blockdev
{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}:
Could not read qcow2 header: Invalid argument
>
> If that is supposed to work, then qemu devs will probably need to know
> about that, if that is not supposed to work, libvirt needs to add a
> check, because the error doesn't tell much. It's also possible I've
> messed up when formatting the image though, as didn't really try to
> figure out what's happening.
>
That's a good question, and I don't actually know the answer. Were you
using an actual vdpa block device for your tests or were you using the
vdpa block simulator kernel module? How did you set it up? Adding
Stefano to cc for his thoughts.
Yep, I would also like to understand how you initialized the device
with a qcow2 format.
Theoretically, the best use case for vDPA block is that the backend
handles formats, for QEMU it should just be a virtio device, but being
a blockdev, we should be able to use formats anyway, so it should
work.
For now, waiting for real hardware, the only way to test vDPA block
support in QEMU is to use the simulator in the kernel or VDUSE.
With the kernel simulator we only have a 128 MB ramdisk available,
with VDUSE you can use QSD with any file:
$ modprobe -a vhost_vdpa vduse
$ qemu-storage-daemon \
--blockdev
file,filename=/path/to/image.qcow2,cache.direct=on,aio=native,node-name=file
\
--blockdev qcow2,file=file,node-name=qcow2 \
--export vduse-blk,id=vduse0,name=vduse0,num-queues=1,node-name=qcow2,writable=on
$ vdpa dev add name vduse0 mgmtdev vduse
Then you have a /dev/vhost-vdpa-X device that you can use with the
`virtio-blk-vhost-vdpa` blockdev (note: vduse requires QEMU with a
memory-backed with `share=on`), but using raw since the qcow2 is
handled by QSD.
Of course, we should be able to use raw file with QSD and qcow2 on
qemu (although it's not the optimal configuration), but I don't know
how to initialize a `virtio-blk-vhost-vdpa` blockdev with a qcow2
image :-(
Thanks,
Stefano