qemu: monitor: Store whether 'query-named-block-nodes' supports 'flat' parameter

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-11-09 10:53:49 +01:00
parent 3fe74ebd90
commit b0e4ad5263
2 changed files with 5 additions and 1 deletions

View File

@ -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,

View File

@ -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;
};