mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +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;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virQEMUDriverPtr driver = priv->driver;
|
virQEMUDriverPtr driver = priv->driver;
|
||||||
g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
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)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon, supports_flat);
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2199,17 +2199,20 @@ qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon,
|
|||||||
/**
|
/**
|
||||||
* qemuMonitorBlockGetNamedNodeData:
|
* qemuMonitorBlockGetNamedNodeData:
|
||||||
* @mon: monitor object
|
* @mon: monitor object
|
||||||
|
* @supports_flat: don't query data for backing store
|
||||||
*
|
*
|
||||||
* Uses 'query-named-block-nodes' to retrieve information about individual
|
* Uses 'query-named-block-nodes' to retrieve information about individual
|
||||||
* storage nodes and returns them in a hash table of qemuBlockNamedNodeDataPtrs
|
* storage nodes and returns them in a hash table of qemuBlockNamedNodeDataPtrs
|
||||||
* filled with the data. The hash table keys are node names.
|
* filled with the data. The hash table keys are node names.
|
||||||
*/
|
*/
|
||||||
virHashTablePtr
|
virHashTablePtr
|
||||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon)
|
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||||
|
bool supports_flat)
|
||||||
{
|
{
|
||||||
QEMU_CHECK_MONITOR_NULL(mon);
|
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
|
virHashTablePtr
|
||||||
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon);
|
qemuMonitorBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||||
|
bool supports_flat);
|
||||||
|
|
||||||
int qemuMonitorBlockResize(qemuMonitorPtr mon,
|
int qemuMonitorBlockResize(qemuMonitorPtr mon,
|
||||||
const char *device,
|
const char *device,
|
||||||
|
@ -3014,11 +3014,12 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes)
|
|||||||
|
|
||||||
|
|
||||||
virHashTablePtr
|
virHashTablePtr
|
||||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon)
|
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||||
|
bool supports_flat)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) nodes = NULL;
|
g_autoptr(virJSONValue) nodes = NULL;
|
||||||
|
|
||||||
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, false)))
|
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, supports_flat)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes);
|
return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes);
|
||||||
|
@ -91,7 +91,8 @@ virHashTablePtr
|
|||||||
qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes);
|
qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes);
|
||||||
|
|
||||||
virHashTablePtr
|
virHashTablePtr
|
||||||
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon);
|
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon,
|
||||||
|
bool supports_flat);
|
||||||
|
|
||||||
int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
|
int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
|
||||||
const char *device,
|
const char *device,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user