qemuMonitorJSONQueryNamedBlockNodes: Drop 'flat' argument

All callers pass the equivalent of looking up whether qemu supports
QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT. Use
'mon->queryNamedBlockNodesFlat' directly and refactor all callers.

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 11:12:48 +01:00
parent bbd4d48993
commit 2f6e858b3c
5 changed files with 10 additions and 19 deletions

View File

@ -2611,13 +2611,11 @@ qemuBlockGetNamedNodeData(virDomainObj *vm,
{
qemuDomainObjPrivate *priv = vm->privateData;
GHashTable *blockNamedNodeData = NULL;
bool supports_flat = virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
return NULL;
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon, supports_flat);
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
qemuDomainObjExitMonitor(vm);

View File

@ -1990,20 +1990,17 @@ qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitor *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 qemuBlockNamedNodeData *s
* filled with the data. The hash table keys are node names.
*/
GHashTable *
qemuMonitorBlockGetNamedNodeData(qemuMonitor *mon,
bool supports_flat)
qemuMonitorBlockGetNamedNodeData(qemuMonitor *mon)
{
QEMU_CHECK_MONITOR_NULL(mon);
VIR_DEBUG("supports_flat=%d", supports_flat);
return qemuMonitorJSONBlockGetNamedNodeData(mon, supports_flat);
return qemuMonitorJSONBlockGetNamedNodeData(mon);
}

View File

@ -712,8 +712,7 @@ struct _qemuBlockNamedNodeData {
};
GHashTable *
qemuMonitorBlockGetNamedNodeData(qemuMonitor *mon,
bool supports_flat);
qemuMonitorBlockGetNamedNodeData(qemuMonitor *mon);
int qemuMonitorBlockResize(qemuMonitor *mon,
const char *device,

View File

@ -2037,14 +2037,13 @@ qemuMonitorJSONSetDBusVMStateIdList(qemuMonitor *mon,
* Returns: NULL on error, reply on success
*/
static virJSONValue *
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon,
bool flat)
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes",
"B:flat", flat,
"B:flat", mon->queryNamedBlockNodesFlat,
NULL)))
return NULL;
@ -2503,7 +2502,7 @@ qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon,
{
g_autoptr(virJSONValue) nodes = NULL;
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, mon->queryNamedBlockNodesFlat)))
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon)))
return -1;
if (virJSONValueArrayForeachSteal(nodes,
@ -2669,12 +2668,11 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValue *nodes)
GHashTable *
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitor *mon,
bool supports_flat)
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitor *mon)
{
g_autoptr(virJSONValue) nodes = NULL;
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, supports_flat)))
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon)))
return NULL;
return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes);

View File

@ -105,8 +105,7 @@ GHashTable *
qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValue *nodes);
GHashTable *
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitor *mon,
bool supports_flat);
qemuMonitorJSONBlockGetNamedNodeData(qemuMonitor *mon);
int
qemuMonitorJSONBlockResize(qemuMonitor *mon,