[libvirt] [RFC PATCH 1/2] qemu: caps: Add capability for dynamic 'auto-read-only' support for files

Ján Tomko jtomko at redhat.com
Mon Aug 26 18:46:29 UTC 2019


On Fri, Aug 16, 2019 at 04:37:59PM +0200, Peter Krempa wrote:
>Initial implementation of 'auto-read-only' didn't reopen the backing
>files when needed. For '-blockdev' to work we need to be able to tel

tell

>qemu to open a file read-only and change it during blockjobs as we label
>backing chains with a sVirt label which does not allow writing. The
>dynamic auto-read-only supports this as it reopens files when writing
>is demanded.
>
>Add a capability to detect that the posix file based backends support
>the dynamic part.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
>---
> src/qemu/qemu_capabilities.c                     | 2 ++
> src/qemu/qemu_capabilities.h                     | 1 +
> tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 +
> 3 files changed, 4 insertions(+)
>
>diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>index c9677315ab..83b1a12d14 100644
>--- a/src/qemu/qemu_capabilities.c
>+++ b/src/qemu/qemu_capabilities.c
>@@ -537,6 +537,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
>               /* 335 */
>               "bochs-display",
>               "migration-file-drop-cache",
>+              "blockdev-file-dynamic-auto-read-only",

The string representation follows the QEMU path

>     );
>
>
>@@ -1281,6 +1282,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
>     { "query-display-options/ret-type/+egl-headless/rendernode", QEMU_CAPS_EGL_HEADLESS_RENDERNODE },
>     { "nbd-server-add/arg-type/bitmap", QEMU_CAPS_NBD_BITMAP },
>     { "blockdev-add/arg-type/+file/drop-cache", QEMU_CAPS_MIGRATION_FILE_DROP_CACHE },
>+    { "blockdev-add/arg-type/+file/$dynamic-auto-read-only", QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC },
> };
>
> typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
>diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
>index 68ef6c49b4..2fe0e26ced 100644
>--- a/src/qemu/qemu_capabilities.h
>+++ b/src/qemu/qemu_capabilities.h
>@@ -518,6 +518,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
>     /* 335 */
>     QEMU_CAPS_DEVICE_BOCHS_DISPLAY, /* -device bochs-display */
>     QEMU_CAPS_MIGRATION_FILE_DROP_CACHE, /* migration with disk cache on is safe for type='file' disks */
>+    QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC, /* the auto-read-only property of block backends for files is dynamic */

But the constant has the words in a random order.

Would QEMU_CAPS_BLOCKDEV_DYNAMIC_AUTO_READONLY be enough?
It's internal so we can rename it later if needed.

Also, the capability rewrapping script should be capable of handling
two-line comments. (Three lines would require changing it)

>
>     QEMU_CAPS_LAST /* this must always be the last item */
> } virQEMUCapsFlags;

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190826/9e12f23e/attachment-0001.sig>


More information about the libvir-list mailing list