提交 95080cc8 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 855211bb
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册