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
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(a)redhat.com>
Reviewed-by: Jiri Denemark <jdenemar(a)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 9b19930964..a3de99d365 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -539,6 +539,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"migration-file-drop-cache",
"net-socket-dgram",
"dbus-vmstate",
+ "blockdev-file-dynamic-auto-read-only",
);
@@ -1284,6 +1285,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 54f91151c6..f16c0c91fa 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -520,6 +520,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check
*/
QEMU_CAPS_MIGRATION_FILE_DROP_CACHE, /* migration with disk cache on is safe for
type='file' disks */
QEMU_CAPS_NET_SOCKET_DGRAM, /* -net socket,fd= with dgram socket */
QEMU_CAPS_DBUS_VMSTATE, /* -object dbus-vmstate */
+ QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC, /* the auto-read-only property of block
backends for files is dynamic */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
index 05e6538e37..540512c67d 100644
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
@@ -210,6 +210,7 @@
<flag name='bochs-display'/>
<flag name='migration-file-drop-cache'/>
<flag name='net-socket-dgram'/>
+ <flag name='blockdev-file-dynamic-auto-read-only'/>
<version>4000050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100759</microcodeVersion>
--
2.21.0