v3:
* separate generic vhost-user-server code from vhost-user-blk-server
code
* re-write vu_message_read and kick hander function as coroutines to
directly call blk_co_preadv, blk_co_pwritev, etc.
* add aio_context notifier functions to support multi-threading model
* other fixes regarding coding style, warning report, etc.
v2:
* Only enable this feauture for Linux because eventfd is a Linux-specific
feature
This patch series is an implementation of vhost-user block device
backend server, thanks to Stefan and Kevin's guidance.
Vhost-user block device backend server is a UserCreatable object and can be
started using object_add,
(qemu) object_add
vhost-user-blk-server,id=ID,unix-socket=/tmp/vhost-user-blk_vhost.socket,node-name=DRIVE_NAME,writable=off,blk-size=512
(qemu) object_del ID
or appending the "-object" option when starting QEMU,
$ -object
vhost-user-blk-server,id=disk,unix-socket=/tmp/vhost-user-blk_vhost.socket,node-name=DRIVE_NAME,writable=off,blk-size=512
Then vhost-user client can connect to the server backend.
For example, QEMU could act as a client,
$ -m 256 -object memory-backend-memfd,id=mem,size=256M,share=on -numa
node,memdev=mem -chardev socket,id=char1,path=/tmp/vhost-user-blk_vhost.socket
-device vhost-user-blk-pci,id=blk0,chardev=char1
And guest OS could access this vhost-user block device after mouting it.
Coiby Xu (5):
extend libvhost to support IOThread and coroutine
generic vhost user server
vhost-user block device backend server
a standone-alone tool to directly share disk image file via vhost-user
protocol
new qTest case to test the vhost-user-blk-server
Makefile | 4 +
Makefile.target | 1 +
backends/Makefile.objs | 2 +
backends/vhost-user-blk-server.c | 716 ++++++++++++++++++++++++++
backends/vhost-user-blk-server.h | 21 +
configure | 3 +
contrib/libvhost-user/libvhost-user.c | 54 +-
contrib/libvhost-user/libvhost-user.h | 38 +-
qemu-vu.c | 252 +++++++++
tests/libqos/vhost-user-blk.c | 126 +++++
tests/libqos/vhost-user-blk.h | 44 ++
tests/vhost-user-blk-test.c | 694 +++++++++++++++++++++++++
util/Makefile.objs | 3 +
util/vhost-user-server.c | 429 ++++++++++++++++
util/vhost-user-server.h | 56 ++
vl.c | 4 +
16 files changed, 2440 insertions(+), 7 deletions(-)
create mode 100644 backends/vhost-user-blk-server.c
create mode 100644 backends/vhost-user-blk-server.h
create mode 100644 qemu-vu.c
create mode 100644 tests/libqos/vhost-user-blk.c
create mode 100644 tests/libqos/vhost-user-blk.h
create mode 100644 tests/vhost-user-blk-test.c
create mode 100644 util/vhost-user-server.c
create mode 100644 util/vhost-user-server.h
--
2.25.0