On 09/03/2017 10:40 PM, Liu Qing wrote:
Add qemu capabilities QEMU_CAPS_L2_CACHE_SIZE,
QEMU_CAPS_REFCOUNT_CACHE_SIZE, QEMU_CAPS_CACHE_CLEAN_INTERVAL.
Add testing for the above qemu capabilities.
Signed-off-by: Liu Qing <liuqing(a)huayun.com>
---
src/qemu/qemu_capabilities.c | 15 +++++++
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_command.c | 47 ++++++++++++++++++++--
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 2 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 3 ++
.../caps_2.6.0-gicv2.aarch64.xml | 3 ++
.../caps_2.6.0-gicv3.aarch64.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 3 ++
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 3 ++
...argv-disk-drive-qcow2-cache-clean-interval.args | 27 +++++++++++++
...emuxml2argv-disk-drive-qcow2-l2-cache-size.args | 27 +++++++++++++
...2argv-disk-drive-qcow2-refcount-cache-size.args | 27 +++++++++++++
tests/qemuxml2argvtest.c | 6 +++
20 files changed, 187 insertions(+), 3 deletions(-)
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-cache-clean-interval.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-l2-cache-size.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-refcount-cache-size.args
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e7ea6f4..619735d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -376,6 +376,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"nec-usb-xhci-ports",
"virtio-scsi-pci.iothread",
"name-guest",
+ "l2-cache-size",
+ "refcount-cache-size",
oh no, we don't add capabilities in the middle - only at the end.
and I think we should name them "drive.l2-cache-size" and
"drive.refount-cache-size" since they're "-drive" attributes.
You could even be more specific "drive.qcow2.l2-cache-size"
/* 225 */
"qxl.max_outputs",
@@ -418,6 +420,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"query-named-block-nodes",
"cpu-cache",
"qemu-xhci",
+ "cache-clean-interval",
Similar here - at end and use "drive.cache-clean-interval"
/* 255 */
"kernel-irqchip",
@@ -4753,6 +4756,14 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (qemuCaps->version >= 2002000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
+ /* qcow2 l2-cache-size option is supported v2.2.0 onwards */
this would technically I believe be something along the lines of :
-drive file=$path,format=qcow2,refcount-cache-size=$size
+ if (qemuCaps->version >= 2002000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_L2_CACHE_SIZE);
This is not the preferred mechanism to do this. Is there no other way to
determine that those attributes exist?
It seems its not easy since the parameter is then based off of
format=qcow2 and further validation using virQEMUCapsCommandLineProps
virQEMUCapsCommandLine[] is not possible. Maybe someone else has a
bright idea.
The name should incorporate DRIVE, e.g. QEMU_CAPS_DRIVE_L2_CACHE_SIZE
(likewise for others since they're a -drive properties, kinda). Maybe
even use "QCOW2" instead of "DRIVE"
+
+ /* qcow2 refcount_cache_size option is supported v2.2.0 onwards */
+ if (qemuCaps->version >= 2002000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_REFCOUNT_CACHE_SIZE);
+
With QEMU 2.8 we could determine this via query-qmp-schema, but you seem
to want 2.2 and beyond...
I almost think we should only do this via the introspection via adding
to the virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] entries:
{ "blockdev-add/arg-type/+qcow2/l2-cache-size",
QEMU_CAPS_DRIVE_L2_CACHE_SIZE },
{ "blockdev-add/arg-type/+qcow2/refcount-cache-size",
QEMU_CAPS_DRIVE_REFCOUNT_CACHE_SIZE },
{ "blockdev-add/arg-type/+qcow2/cache-clean-interval",
QEMU_CAPS_DRIVE_CACHE_CLEAN_INTERVAL },
Perhaps others would have comment here too...
/* -cpu ...,aarch64=off supported in v2.3.0 and onwards. But it
isn't detectable via qmp at this point */
if (qemuCaps->arch == VIR_ARCH_AARCH64 &&
@@ -4772,6 +4783,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (qemuCaps->version >= 2004050)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+ /* qcow2 cache_clean_interval option is supported v2.5.0 onwards */
+ if (qemuCaps->version >= 2005000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CACHE_CLEAN_INTERVAL);
+
Likewise... but 2.5 and beyond.
/* no way to query if -machine kernel_irqchip supports split */
if (qemuCaps->version >= 2006000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index f32687d..f1302ee 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -362,6 +362,8 @@ typedef enum {
QEMU_CAPS_NEC_USB_XHCI_PORTS, /* -device nec-usb-xhci.p3 ports setting */
QEMU_CAPS_VIRTIO_SCSI_IOTHREAD, /* virtio-scsi-{pci,ccw}.iothread */
QEMU_CAPS_NAME_GUEST, /* -name guest= */
+ QEMU_CAPS_L2_CACHE_SIZE, /* -drive support qcow2 l2 cache size */
+ QEMU_CAPS_REFCOUNT_CACHE_SIZE, /* -drive support qcow2 refcount cache size */
/* 225 */
QEMU_CAPS_QXL_MAX_OUTPUTS, /* -device qxl,max-outputs= */
@@ -404,6 +406,7 @@ typedef enum {
QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */
QEMU_CAPS_CPU_CACHE, /* -cpu supports host-cache-info and l3-cache properties */
QEMU_CAPS_DEVICE_QEMU_XHCI, /* -device qemu-xhci */
+ QEMU_CAPS_CACHE_CLEAN_INTERVAL, /* -drive qcow2 cache clean interval */
Similarly - add at the end only.
/* 255 */
QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, /* -machine kernel_irqchip */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7996eed..0ace3ff 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1430,12 +1430,53 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
qemuformat = "luks";
virBufferAsprintf(buf, "format=%s,", qemuformat);
}
- if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
disk->src->l2_cache_size > 0)
+ if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
Rather than checking format here, this should be done somewhere in the
XML validation to ensure that these parameters aren't added to a disk
with driver unless qcow2 format is being used.
Thus not needing the errors below... More recent push is to not format
or validation error checking once the command line is being built as
this should already have been done.
That way all that is added is what you have in patch1...
John
+ disk->src->l2_cache_size > 0 &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_L2_CACHE_SIZE)) {
virBufferAsprintf(buf, "l2-cache-size=%u,",
disk->src->l2_cache_size);
- if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
disk->src->refcount_cache_size > 0)
+ } else if (disk->src->l2_cache_size > 0 &&
+ disk->src->format != VIR_STORAGE_FILE_QCOW2) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("l2-cache-size is supported by QCOW2 format only"));
+ goto cleanup;
+ } else if (disk->src->l2_cache_size > 0 &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_L2_CACHE_SIZE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("l2-cache-size is not supported by this QEMU"));
+ goto cleanup;
+ }
+
+ if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
+ disk->src->refcount_cache_size > 0 &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_REFCOUNT_CACHE_SIZE)) {
virBufferAsprintf(buf, "refcount-cache-size=%u,",
disk->src->refcount_cache_size);
- if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
disk->src->cache_clean_interval > 0)
+ } else if (disk->src->refcount_cache_size > 0 &&
+ disk->src->format != VIR_STORAGE_FILE_QCOW2) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("refcount-cache-size is supported by QCOW2 format
only"));
+ goto cleanup;
+ } else if (disk->src->refcount_cache_size > 0 &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_REFCOUNT_CACHE_SIZE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("refcount-cache-size is not supported by this
QEMU"));
+ goto cleanup;
+ }
+
+ if (disk->src->format == VIR_STORAGE_FILE_QCOW2 &&
+ disk->src->cache_clean_interval > 0 &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_CACHE_CLEAN_INTERVAL)) {
virBufferAsprintf(buf, "cache-clean-interval=%u,",
disk->src->cache_clean_interval);
+ } else if (disk->src->cache_clean_interval > 0 &&
+ disk->src->format != VIR_STORAGE_FILE_QCOW2) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("cache-clean-interval is supported by QCOW2 format
only"));
+ goto cleanup;
+ } else if (disk->src->cache_clean_interval > 0 &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CACHE_CLEAN_INTERVAL)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("cache-clean-interval is not supported by this
QEMU"));
+ goto cleanup;
+ }
ret = 0;
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index f97e4cb..e69bef7 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -171,6 +171,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index 2ba40fc..28fa421 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -175,6 +175,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
@@ -190,6 +192,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='vnc-multi-servers'/>
<flag name='chardev-reconnect'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
index 0b34fa3..b7e0121 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
@@ -153,6 +153,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -167,6 +169,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='vnc-multi-servers'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
index d41d578..a995e2f 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
@@ -153,6 +153,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -167,6 +169,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='vnc-multi-servers'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
index f1c9fc9..59ba6fa 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
@@ -146,6 +146,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -161,6 +163,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='spapr-pci-host-bridge'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index bdf006f..064d447 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -181,6 +181,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
@@ -199,6 +201,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='vnc-multi-servers'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
index fe7bca9..0eef3c6 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
@@ -115,6 +115,8 @@
<flag name='device-tray-moved-event'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -129,6 +131,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='vnc-multi-servers'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
index 3fd28f0..c391536 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
@@ -181,6 +181,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
@@ -201,6 +203,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='intel-iommu.intremap'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
index 21bbb82..ada5de5 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
@@ -115,6 +115,8 @@
<flag name='device-tray-moved-event'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -131,6 +133,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='vnc-multi-servers'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index 761f9d1..61057d9 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -181,6 +181,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
@@ -202,6 +204,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='intel-iommu.intremap'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml
index a373a6d..a82b506 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml
@@ -143,6 +143,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -163,6 +165,7 @@
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
<flag name='qemu-xhci'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='virtio.iommu_platform'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
index e80782c..473e95e 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
@@ -113,6 +113,8 @@
<flag name='device-tray-moved-event'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='drive-detect-zeroes'/>
<flag name='tls-creds-x509'/>
<flag name='display'/>
@@ -130,6 +132,7 @@
<flag name='query-cpu-definitions'/>
<flag name='block-write-threshold'/>
<flag name='query-named-block-nodes'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='virtio.iommu_platform'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 3641d03..9ac72ca 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -181,6 +181,8 @@
<flag name='nec-usb-xhci-ports'/>
<flag name='virtio-scsi-pci.iothread'/>
<flag name='name-guest'/>
+ <flag name='l2-cache-size'/>
+ <flag name='refcount-cache-size'/>
<flag name='qxl.max_outputs'/>
<flag name='spice-unix'/>
<flag name='drive-detect-zeroes'/>
@@ -209,6 +211,7 @@
<flag name='query-named-block-nodes'/>
<flag name='cpu-cache'/>
<flag name='qemu-xhci'/>
+ <flag name='cache-clean-interval'/>
<flag name='kernel-irqchip'/>
<flag name='kernel-irqchip.split'/>
<flag name='intel-iommu.intremap'/>
diff --git
a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-cache-clean-interval.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-cache-clean-interval.args
new file mode 100644
index 0000000..ceaf299
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-cache-clean-interval.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,cache-clean-interval=900,\
+if=none,id=drive-ide0-0-0,cache=none \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,media=cdrom,\
+id=drive-ide0-1-0,readonly=on \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-l2-cache-size.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-l2-cache-size.args
new file mode 100644
index 0000000..4240477
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-l2-cache-size.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,l2-cache-size=2097152,if=none,\
+id=drive-ide0-0-0,cache=none \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,media=cdrom,\
+id=drive-ide0-1-0,readonly=on \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git
a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-refcount-cache-size.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-refcount-cache-size.args
new file mode 100644
index 0000000..b6ecacf
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-qcow2-refcount-cache-size.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,refcount-cache-size=524288,\
+if=none,id=drive-ide0-0-0,cache=none \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,media=cdrom,\
+id=drive-ide0-1-0,readonly=on \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 18f06e5..608ca18 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -910,6 +910,12 @@ mymain(void)
QEMU_CAPS_DRIVE_CACHE_UNSAFE);
DO_TEST("disk-drive-copy-on-read",
QEMU_CAPS_DRIVE_COPY_ON_READ);
+ DO_TEST("disk-drive-qcow2-l2-cache-size",
+ QEMU_CAPS_L2_CACHE_SIZE);
+ DO_TEST("disk-drive-qcow2-refcount-cache-size",
+ QEMU_CAPS_REFCOUNT_CACHE_SIZE);
+ DO_TEST("disk-drive-qcow2-cache-clean-interval",
+ QEMU_CAPS_CACHE_CLEAN_INTERVAL);
DO_TEST("disk-drive-network-nbd", NONE);
DO_TEST("disk-drive-network-nbd-export", NONE);
DO_TEST("disk-drive-network-nbd-ipv6", NONE);