[PATCH 2/4] qemu: monitor: Store whether 'query-named-block-nodes' supports 'flat' parameter

Peter Krempa pkrempa at redhat.com
Wed Nov 9 10:17:13 UTC 2022


Rather than having callers always pass this flag store it in the
qemuMonitor object. Following patches will convert the code to use this
internal flag.

In the future this will also simplify removal when all supported qemu
versions will support the new mode.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.c      | 4 +++-
 src/qemu/qemu_monitor_priv.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d09c561e47..dd394cd19b 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -622,8 +622,10 @@ qemuMonitorOpenInternal(virDomainObj *vm,
     mon->waitGreeting = true;
     mon->cb = cb;

-    if (priv)
+    if (priv) {
         mon->objectAddNoWrap = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_JSON);
+        mon->queryNamedBlockNodesFlat = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
+    }

     if (virSetCloseExec(mon->fd) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
index 2f7c662cef..0826a1da94 100644
--- a/src/qemu/qemu_monitor_priv.h
+++ b/src/qemu/qemu_monitor_priv.h
@@ -90,6 +90,8 @@ struct _qemuMonitor {

     /* true if qemu no longer wants 'props' sub-object of object-add */
     bool objectAddNoWrap;
+    /* query-named-block-nodes supports the 'flat' option */
+    bool queryNamedBlockNodesFlat;
 };


-- 
2.37.3



More information about the libvir-list mailing list