From 3275be238c2896dd6a5ba8c66f2f047bba7bb1e5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 16 Dec 2021 11:00:55 +0100 Subject: [PATCH] qemu: monitor: Extract whether qcow2 image uses extended L2 allocation data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to be able to propagate image configuration to newly formatted images we need to be able to query it. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 29746f0b8e..850e01f026 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -784,6 +784,9 @@ struct _qemuBlockNamedNodeData { /* image version */ bool qcow2v2; + + /* qcow2 subcluster allocation -> extended_l2 */ + bool qcow2extendedL2; }; GHashTable * diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a3d6eca569..6eedc925c4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2806,9 +2806,13 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos G_GNUC_UNUSED, STREQ_NULLABLE(virJSONValueObjectGetString(format_specific, "type"), "qcow2")) { virJSONValue *qcow2props = virJSONValueObjectGetObject(format_specific, "data"); - if (qcow2props && - STREQ_NULLABLE(virJSONValueObjectGetString(qcow2props, "compat"), "0.10")) - ent->qcow2v2 = true; + if (qcow2props) { + if (STREQ_NULLABLE(virJSONValueObjectGetString(qcow2props, "compat"), "0.10")) + ent->qcow2v2 = true; + + ignore_value(virJSONValueObjectGetBoolean(qcow2props, "extended-l2", + &ent->qcow2extendedL2)); + } } if (virHashAddEntry(nodes, nodename, ent) < 0)