[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 11/13] block/export: convert vhost-user-blk server to bloc
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 11/13] block/export: convert vhost-user-blk server to block export API |
Date: |
Wed, 30 Sep 2020 07:28:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Stefan Hajnoczi <stefanha@redhat.com> writes:
> Use the new QAPI block exports API instead of defining our own QOM
> objects.
>
> This is a large change because the lifecycle of VuBlockDev needs to
> follow BlockExportDriver. QOM properties are replaced by QAPI options
> objects.
>
> VuBlockDev is renamed VuBlkExport and contains a BlockExport field.
> Several fields can be dropped since BlockExport already has equivalents.
>
> The file names and meson build integration will be adjusted in a future
> patch. libvhost-user should probably be built as a static library that
> is linked into QEMU instead of as a .c file that results in duplicate
> compilation.
>
> The new command-line syntax is:
>
> $ qemu-storage-daemon \
> --blockdev file,node-name=drive0,filename=test.img \
> --export
> vhost-user-blk,node-name=drive0,id=export0,unix-socket=/tmp/vhost-user-blk.sock
>
> Note that unix-socket is optional because we may wish to accept chardevs
> too in the future.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> v2:
> * Replace str unix-socket with SocketAddress addr to match NBD and
> support file descriptor passing
> * Make addr mandatory [Markus]
> * Update vhost-user-blk-test.c to use --export syntax
> ---
> qapi/block-export.json | 21 +-
> block/export/vhost-user-blk-server.h | 23 +-
> block/export/export.c | 8 +-
> block/export/vhost-user-blk-server.c | 452 +++++++--------------------
> tests/qtest/vhost-user-blk-test.c | 2 +-
> util/vhost-user-server.c | 10 +-
> block/export/meson.build | 1 +
> block/meson.build | 1 -
> 8 files changed, 158 insertions(+), 360 deletions(-)
>
> diff --git a/qapi/block-export.json b/qapi/block-export.json
> index ace0d66e17..2e44625bb1 100644
> --- a/qapi/block-export.json
> +++ b/qapi/block-export.json
> @@ -84,6 +84,21 @@
> 'data': { '*name': 'str', '*description': 'str',
> '*bitmap': 'str' } }
>
> +##
> +# @BlockExportOptionsVhostUserBlk:
> +#
> +# A vhost-user-blk block export.
> +#
> +# @addr: The vhost-user socket on which to listen. Both 'unix' and 'fd'
> +# SocketAddress types are supported. Passed fds must be UNIX domain
> +# sockets.
"addr.type must be 'unix' or 'fd'" is not visible in introspection.
Awkward. Practical problem only if other addresses ever become
available here. Is that possible?
> +# @logical-block-size: Logical block size in bytes. Defaults to 512 bytes.
> +#
> +# Since: 5.2
> +##
> +{ 'struct': 'BlockExportOptionsVhostUserBlk',
> + 'data': { 'addr': 'SocketAddress', '*logical-block-size': 'size' } }
> +
> ##
> # @NbdServerAddOptions:
> #
> @@ -180,11 +195,12 @@
> # An enumeration of block export types
> #
> # @nbd: NBD export
> +# @vhost-user-blk: vhost-user-blk export (since 5.2)
> #
> # Since: 4.2
> ##
> { 'enum': 'BlockExportType',
> - 'data': [ 'nbd' ] }
> + 'data': [ 'nbd', 'vhost-user-blk' ] }
>
> ##
> # @BlockExportOptions:
> @@ -213,7 +229,8 @@
> '*writethrough': 'bool' },
> 'discriminator': 'type',
> 'data': {
> - 'nbd': 'BlockExportOptionsNbd'
> + 'nbd': 'BlockExportOptionsNbd',
> + 'vhost-user-blk': 'BlockExportOptionsVhostUserBlk'
> } }
>
> ##
[...]
- [PATCH v2 02/13] util/vhost-user-server: s/fileds/fields/ typo fix, (continued)
- [PATCH v2 02/13] util/vhost-user-server: s/fileds/fields/ typo fix, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 03/13] util/vhost-user-server: drop unnecessary QOM cast, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 04/13] util/vhost-user-server: drop unnecessary watch deletion, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 05/13] block/export: consolidate request structs into VuBlockReq, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 06/13] util/vhost-user-server: drop unused DevicePanicNotifier, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 07/13] util/vhost-user-server: fix memory leak in vu_message_read(), Stefan Hajnoczi, 2020/09/24
- [PATCH v2 08/13] util/vhost-user-server: check EOF when reading payload, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 09/13] util/vhost-user-server: rework vu_client_trip() coroutine lifecycle, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 10/13] block/export: report flush errors, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 11/13] block/export: convert vhost-user-blk server to block export API, Stefan Hajnoczi, 2020/09/24
- Re: [PATCH v2 11/13] block/export: convert vhost-user-blk server to block export API,
Markus Armbruster <=
- [PATCH v2 13/13] util/vhost-user-server: use static library in meson.build, Stefan Hajnoczi, 2020/09/24
- [PATCH v2 12/13] util/vhost-user-server: move header to include/, Stefan Hajnoczi, 2020/09/24