[PATCH 2/3] qemu: capabilities: Condemn the use of 'device.json' capability name

Peter Krempa pkrempa at redhat.com
Mon Jan 3 15:25:55 UTC 2022


As a workaround for users using 'libvirt-7.9' and 'libvirt-7.10' with
'qemu-6.2' who wish to use device hot-unplug we are going to be
suggesting to filter out the 'device.json' qemu capability via either
the global 'qemu.conf' config:

  capability_filters = [ "device.json" ]

or the per-VM XML capability override:

 <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

 [...]

  <qemu:capabilities>
    <qemu:del capability='device.json'/>
  </qemu:capabilities>
 </domain>

Doing this poisons the capability name 'device.json' for any further
use, so to ensure that we can re-add JSON usage for -device also for
users which filtered it out originally once it's fixed in qemu we need
to condemn the old name and add a new one.

To achieve this the old capability is renamed to
'X_QEMU_CAPS_DEVICE_JSON_BROKEN' and a new capability
'QEMU_CAPS_DEVICE_JSON' is mapped to 'device.json-fixed'. For now we
leave it unasserted, but this allows to keep all the code in place.

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

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2efe5776f8..e650e81ab8 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -649,10 +649,11 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "chardev.json", /* QEMU_CAPS_CHARDEV_JSON */

               /* 415 */
-              "device.json", /* QEMU_CAPS_DEVICE_JSON */
+              "device.json", /* X_QEMU_CAPS_DEVICE_JSON_BROKEN */
               "query-dirty-rate", /* QEMU_CAPS_QUERY_DIRTY_RATE */
               "rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
               "sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
+              "device.json-fixed" /* QEMU_CAPS_DEVICE_JSON */
     );


diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index aaac20a834..43cf8464ae 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -628,10 +628,11 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_CHARDEV_JSON, /* -chardev accepts JSON */

     /* 415 */
-    QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON */
+    X_QEMU_CAPS_DEVICE_JSON_BROKEN, /* -device accepts JSON - unused due a qemu regression */
     QEMU_CAPS_QUERY_DIRTY_RATE, /* accepts query-dirty-rate */
     QEMU_CAPS_RBD_ENCRYPTION, /* Ceph RBD encryption support */
     QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
+    QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON */

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




More information about the libvir-list mailing list