Such images don't support stuff like dirty bitmaps. Note that the
synthetic test for detecting bitmaps is used as an example to prevent
adding additional test cases.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_monitor.h | 3 +++
src/qemu/qemu_monitor_json.c | 11 +++++++++++
tests/qemublocktest.c | 2 ++
tests/qemublocktestdata/bitmap/synthetic.json | 2 +-
tests/qemublocktestdata/bitmap/synthetic.out | 1 +
5 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 32dc96ee82..0108703a33 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -732,6 +732,9 @@ struct _qemuBlockNamedNodeData {
/* the cluster size of the image is valid only when > 0 */
unsigned long long clusterSize;
+
+ /* image version */
+ bool qcow2v2;
};
GHashTable *
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f8c78d9093..3a07306365 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2978,6 +2978,7 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos
G_GNUC_UNUSED,
GHashTable *nodes = opaque;
virJSONValuePtr img;
virJSONValuePtr bitmaps;
+ virJSONValuePtr format_specific;
const char *nodename;
g_autoptr(qemuBlockNamedNodeData) ent = NULL;
@@ -3000,6 +3001,16 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos
G_GNUC_UNUSED,
if ((bitmaps = virJSONValueObjectGetArray(val, "dirty-bitmaps")))
qemuMonitorJSONBlockGetNamedNodeDataBitmaps(bitmaps, ent);
+ /* query qcow2 format specific props */
+ if ((format_specific = virJSONValueObjectGetObject(img, "format-specific"))
&&
+ STREQ_NULLABLE(virJSONValueObjectGetString(format_specific, "type"),
"qcow2")) {
+ virJSONValuePtr qcow2props = virJSONValueObjectGetObject(format_specific,
"data");
+
+ if (qcow2props &&
+ STREQ_NULLABLE(virJSONValueObjectGetString(qcow2props, "compat"),
"0.10"))
+ ent->qcow2v2 = true;
+ }
+
if (virHashAddEntry(nodes, nodename, ent) < 0)
return -1;
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index ddaf73359d..bbfcfee92d 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -599,6 +599,8 @@ testQemuDetectBitmapsWorker(GHashTable *nodedata,
return;
virBufferAsprintf(buf, "%s:\n", nodename);
+ if (data->qcow2v2)
+ virBufferAddLit(buf, " qcow2 v2\n");
virBufferAdjustIndent(buf, 1);
for (i = 0; i < data->nbitmaps; i++) {
diff --git a/tests/qemublocktestdata/bitmap/synthetic.json
b/tests/qemublocktestdata/bitmap/synthetic.json
index 3712c8e5fc..cd468a42a2 100644
--- a/tests/qemublocktestdata/bitmap/synthetic.json
+++ b/tests/qemublocktestdata/bitmap/synthetic.json
@@ -12,7 +12,7 @@
"format-specific": {
"type": "qcow2",
"data": {
- "compat": "1.1",
+ "compat": "0.10",
"compression-type": "zlib",
"lazy-refcounts": false,
"bitmaps": [
diff --git a/tests/qemublocktestdata/bitmap/synthetic.out
b/tests/qemublocktestdata/bitmap/synthetic.out
index cde7228e01..2d9545fc9b 100644
--- a/tests/qemublocktestdata/bitmap/synthetic.out
+++ b/tests/qemublocktestdata/bitmap/synthetic.out
@@ -1,4 +1,5 @@
libvirt-1-format:
+ qcow2 v2
current: record:1 busy:0 persist:1 inconsist:1 gran:65536 dirty:0
top-ok: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
top-inactive: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
--
2.29.2