qemu: monitor: Extract whether qcow2 image uses extended L2 allocation data

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>
This commit is contained in:
Peter Krempa 2021-12-16 11:00:55 +01:00
parent df0e867447
commit 3275be238c
2 changed files with 10 additions and 3 deletions

View File

@ -784,6 +784,9 @@ struct _qemuBlockNamedNodeData {
/* image version */ /* image version */
bool qcow2v2; bool qcow2v2;
/* qcow2 subcluster allocation -> extended_l2 */
bool qcow2extendedL2;
}; };
GHashTable * GHashTable *

View File

@ -2806,9 +2806,13 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos G_GNUC_UNUSED,
STREQ_NULLABLE(virJSONValueObjectGetString(format_specific, "type"), "qcow2")) { STREQ_NULLABLE(virJSONValueObjectGetString(format_specific, "type"), "qcow2")) {
virJSONValue *qcow2props = virJSONValueObjectGetObject(format_specific, "data"); virJSONValue *qcow2props = virJSONValueObjectGetObject(format_specific, "data");
if (qcow2props && if (qcow2props) {
STREQ_NULLABLE(virJSONValueObjectGetString(qcow2props, "compat"), "0.10")) if (STREQ_NULLABLE(virJSONValueObjectGetString(qcow2props, "compat"), "0.10"))
ent->qcow2v2 = true; ent->qcow2v2 = true;
ignore_value(virJSONValueObjectGetBoolean(qcow2props, "extended-l2",
&ent->qcow2extendedL2));
}
} }
if (virHashAddEntry(nodes, nodename, ent) < 0) if (virHashAddEntry(nodes, nodename, ent) < 0)