On 1/10/19 7:15 AM, Nikolay Shirokovskiy wrote:
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(a)virtuozzo.com>
---
src/qemu/qemu_capabilities.c | 5 +++++
src/qemu/qemu_capabilities.h | 1 +
2 files changed, 6 insertions(+)
I posted a patch series today that would add/update the capabilities for
3.1 (and 4.0) and thus would add this capability to this patch.
However, given that the only way you've chosen to support/implement this
is via -blockdev, I'm not sure now what the purpose will be unless it's
used to determine whether to use INT64_MAX or some other value.
I see from previous series that it seems to be possible to have:
-drive xxx,format=qcow2,l2-cache-size=VALUE,...
However, patch3 notes in the commit message that "-drive configuration
is not supported because we can not set l2 cache size down the backing
chain in this case."
So if -blockdev is going to be your the option for support, then I think
it'd be wiser to wait for Peter to finish -blockdev support before
acting on this.
Since -blockdev support allows some qemu version earlier the 3.1 to be
supported, then we revisit this. Additionally, referencing Leonid's
qemu.git commit b749562d98 as the "arbiter" of why INT64_MAX must be
used (since calculating a max max value isn't possible, IIRC).
John
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;