]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: Extract whether qcow2 image uses extended L2 allocation data
authorPeter Krempa <pkrempa@redhat.com>
Thu, 16 Dec 2021 10:00:55 +0000 (11:00 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Dec 2021 12:23:09 +0000 (13:23 +0100)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c

index 29746f0b8edcaecdb4c3b17be2110f6f1a7373d8..850e01f02629cefdb19befa10da3f7d298831b5b 100644 (file)
@@ -784,6 +784,9 @@ struct _qemuBlockNamedNodeData {
 
     /* image version */
     bool qcow2v2;
+
+    /* qcow2 subcluster allocation -> extended_l2 */
+    bool qcow2extendedL2;
 };
 
 GHashTable *
index a3d6eca5691be5b9404f3d4f07ab4c84a6c031c1..6eedc925c41ad49f1fc92af5d4a46dddc6a11d61 100644 (file)
@@ -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)