mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu: Don't request nested entries in qemuBlockGetNamedNodeData
Use the 'flat' flag for 'query-named-block-nodes' if qemu supports QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT in qemuBlockGetNamedNodeData. We don't need the data so plumb in whether qemu supports the 'flat' output. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
855211bbf3
commit
95080cc8b4
@ -2768,11 +2768,13 @@ qemuBlockGetNamedNodeData(virDomainObjPtr vm,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virQEMUDriverPtr driver = priv->driver;
|
||||
g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
||||
bool supports_flat = virQEMUCapsGet(priv->qemuCaps,
|
||||
QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return NULL;
|
||||
|
||||
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
||||
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon, supports_flat);
|
||||
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
||||
return NULL;
|
||||
|
@ -2199,17 +2199,20 @@ qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon,
|
||||
/**
|
||||
* qemuMonitorBlockGetNamedNodeData:
|
||||
* @mon: monitor object
|
||||
* @supports_flat: don't query data for backing store
|
||||
*
|
||||
* Uses 'query-named-block-nodes' to retrieve information about individual
|
||||
* storage nodes and returns them in a hash table of qemuBlockNamedNodeDataPtrs
|
||||
* filled with the data. The hash table keys are node names.
|
||||
*/
|
||||
virHashTablePtr
|
||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon)
|
||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||
bool supports_flat)
|
||||
{
|
||||
QEMU_CHECK_MONITOR_NULL(mon);
|
||||
VIR_DEBUG("supports_flat=%d", supports_flat);
|
||||
|
||||
return qemuMonitorJSONBlockGetNamedNodeData(mon);
|
||||
return qemuMonitorJSONBlockGetNamedNodeData(mon, supports_flat);
|
||||
}
|
||||
|
||||
|
||||
|
@ -698,7 +698,8 @@ struct _qemuBlockNamedNodeData {
|
||||
};
|
||||
|
||||
virHashTablePtr
|
||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon);
|
||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||
bool supports_flat);
|
||||
|
||||
int qemuMonitorBlockResize(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
|
@ -3014,11 +3014,12 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes)
|
||||
|
||||
|
||||
virHashTablePtr
|
||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon)
|
||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||
bool supports_flat)
|
||||
{
|
||||
g_autoptr(virJSONValue) nodes = NULL;
|
||||
|
||||
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, false)))
|
||||
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, supports_flat)))
|
||||
return NULL;
|
||||
|
||||
return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes);
|
||||
|
@ -91,7 +91,8 @@ virHashTablePtr
|
||||
qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes);
|
||||
|
||||
virHashTablePtr
|
||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon);
|
||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||
bool supports_flat);
|
||||
|
||||
int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
|
Loading…
Reference in New Issue
Block a user