[PATCH v2 04/12] qemu: capabilities: Introduce QEMU_CAPS_OBJECT_QAPIFIED

Peter Krempa pkrempa at redhat.com
Wed Feb 24 15:57:58 UTC 2021


Starting from qemu-6.0 the parameters of -object/object-add are formally
described by the QAPI schema. Additionally this changes the nesting of
the properties as the 'props' nested object will be flattened to the
parent.

We'll need to detect whether qemu switched to this new approach to
generate the objects with proper nesting and also allow testing.

The capability is based on the presence of the 'secret' object in the
'qom-type' enum.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_capabilities.c | 4 ++++
 src/qemu/qemu_capabilities.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f40d6d77be..d1452f6354 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -618,6 +618,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "memory-backend-file.x-use-canonical-path-for-ramblock-id",
               "vnc-opts",
               "migration-param.block-bitmap-mapping",
+
+              /* 395 */
+              "object.qapified",
     );


@@ -1553,6 +1556,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
     { "netdev_add/arg-type/+vhost-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA },
     { "migrate-set-parameters/arg-type/block-bitmap-mapping/bitmaps/transform",
       QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING },
+    { "object-add/arg-type/qom-type/^secret", QEMU_CAPS_OBJECT_QAPIFIED },
 };

 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a5b6c7f104..193432246d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -599,6 +599,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_VNC_OPTS, /* -vnc uses QemuOpts parser instead of custom code */
     QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING, /* block-bitmap-mapping in migrate-set-parameters */

+    /* 395 */
+    QEMU_CAPS_OBJECT_QAPIFIED, /* parameters for object-add are formally described */
+
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;

-- 
2.29.2




More information about the libvir-list mailing list