On 8/13/20 11:29 AM, Kevin Wolf wrote:
qemu-nbd allows use of writethrough cache modes, which mean that write
requests made through NBD will cause a flush before they complete.
Expose the same functionality in block-export-add.
Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
qapi/block-export.json | 7 ++++++-
blockdev-nbd.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
+++ b/blockdev-nbd.c
@@ -218,7 +218,7 @@ BlockExport *nbd_export_create(BlockExportOptions
*exp_args, Error **errp)
exp = nbd_export_new(bs, arg->name, arg->description, arg->bitmap,
!arg->writable, !arg->writable,
- NULL, false, errp);
+ NULL, exp_args->writethrough, errp);
It would someday be nice to get rid of exp_args->has_writethrough in
QAPI generated code, but that's independent of this series. Meanwhile,
you are safe in relying on writethrough being false when
has_writethrough is false.
This change makes sense to me interface-wise. QAPI-wise, should we try
harder to make writethrough settable only for writable exports (and an
error for read-only exports)? I'm not sure what QAPI contortions would
have to look like to make that enforced by the QMP parser; but it's also
not the end of the world if we just always permit the optional field and
then apply a post-parse semantic check.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org