[libvirt] [PATCH v3 1/5] qemu: caps: add QEMU_CAPS_QCOW2_L2_CACHE_SIZE_CAPPED

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Jan 10 12:15:13 UTC 2019


For qemu capable of setting l2-cache-size for qcow2 images
to INT64_MAX and semantics of upper limit on l2 cache
size. We can only check this by qemu version (3.1.0) now.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
---
 src/qemu/qemu_capabilities.c | 5 +++++
 src/qemu/qemu_capabilities.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f504db7..e09b13a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -520,6 +520,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               /* 325 */
               "memory-backend-file.pmem",
               "nvdimm.unarmed",
+              "qcow2.l2-cache-size.capped",
     );
 
 
@@ -4256,6 +4257,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT);
     }
 
+    /* l2-cache-size before 3001000 does not accept INT64_MAX */
+    if (qemuCaps->version >= 3001000)
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_QCOW2_L2_CACHE_SIZE_CAPPED);
+
     if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
         goto cleanup;
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 6d5ed8a..e17a1dc 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -504,6 +504,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     /* 325 */
     QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem= */
     QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */
+    QEMU_CAPS_QCOW2_L2_CACHE_SIZE_CAPPED, /* -blockdev supports l2-cache-size with INT64_MAX value */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
1.8.3.1




More information about the libvir-list mailing list