On Wed, Dec 11, 2019 at 11:25:32PM +0800, Coiby Xu wrote: > I'm now writing the tests for vhost-user-blk device based on > tests/virtio-blk-test.c. But block_resize command doesn't apply to > vhost-user-blk device. > > After launching vhost-user backend server, I type the following > command to connect to it > > (qemu) chardev-add socket,id=char1,path=/tmp/vhost-user-blk_vhost.socket > (qemu) object_add memory-backend-memfd,id=mem,size=256M,share=on > (qemu) device_add vhost-user-blk-pci,id=blk0,chardev=char1 > (qemu) block_resize blk0 512 > Error: Cannot find device=blk0 nor node_name= > > QEMU can't find the device although in the guest OS I can already > mount /dev/vda. And `info block` doesn't list the newly added > vhost-user-blk device, > (qemu) info block > disk (#block154): dpdk.img (raw) > Attached to: /machine/peripheral-anon/device[0] > Cache mode: writeback > > floppy0: [not inserted] > Attached to: /machine/unattached/device[17] > Removable device: not locked, tray closed > > sd0: [not inserted] > Removable device: not locked, tray close > > It seems `info block` and `block_resize` only work with `drive_add` > which is not necessary for vhost-user-blk device.
Yes, -device vhost-user-blk doesn't have a BlockDriverState (-drive or -blockdev) because it communicates with the vhost-user device backend over a character device instead. > Should I let QEMU > support adding vhost-user backend device in the way similar to adding > NBD device(`drive_add -n buddy > file.driver=nbd,file.host=localhost,file.port=49153,file.export=disk,node-name=nbd_client1`), > i.e., a drive can be added via `drive_add -n buddy > file.driver=vhost-user,file.sock=/tmp/vhost-user-blk_vhost.socket,node-name=vhost_user_client1`? That is probably too much work. It's fine to skip test cases that resize the disk. Stefan
signature.asc
Description: PGP signature
