mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: monitor: Add the 'query-nodes' argument for query-blockstats
The 'query-blockstats' command does not return statistics for the explicitly named nodes unless the new argument is specified. Add infrastrucuture that will allow us to use the new approach if desired. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f78033c4f2
commit
50edca1331
@ -358,7 +358,7 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm));
|
data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm));
|
||||||
blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm));
|
blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm), false);
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -2243,15 +2243,19 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon)
|
|||||||
/**
|
/**
|
||||||
* qemuMonitorQueryBlockstats:
|
* qemuMonitorQueryBlockstats:
|
||||||
* @mon: monitor object
|
* @mon: monitor object
|
||||||
|
* @nodenames: include backing chain nodes with explicitly specified name
|
||||||
*
|
*
|
||||||
* Returns data from a call to 'query-blockstats'.
|
* Returns data from a call to 'query-blockstats'.
|
||||||
*/
|
*/
|
||||||
virJSONValuePtr
|
virJSONValuePtr
|
||||||
qemuMonitorQueryBlockstats(qemuMonitorPtr mon)
|
qemuMonitorQueryBlockstats(qemuMonitorPtr mon,
|
||||||
|
bool nodenames)
|
||||||
{
|
{
|
||||||
QEMU_CHECK_MONITOR_NULL(mon);
|
QEMU_CHECK_MONITOR_NULL(mon);
|
||||||
|
|
||||||
return qemuMonitorJSONQueryBlockstats(mon);
|
VIR_DEBUG("nodenames: %d", nodenames);
|
||||||
|
|
||||||
|
return qemuMonitorJSONQueryBlockstats(mon, nodenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,7 +563,8 @@ int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
|
|||||||
int qemuMonitorBlockIOStatusToError(const char *status);
|
int qemuMonitorBlockIOStatusToError(const char *status);
|
||||||
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);
|
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);
|
||||||
|
|
||||||
virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon);
|
virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon,
|
||||||
|
bool nodenames);
|
||||||
|
|
||||||
typedef struct _qemuBlockStats qemuBlockStats;
|
typedef struct _qemuBlockStats qemuBlockStats;
|
||||||
typedef qemuBlockStats *qemuBlockStatsPtr;
|
typedef qemuBlockStats *qemuBlockStatsPtr;
|
||||||
|
@ -2350,13 +2350,16 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValuePtr dev,
|
|||||||
|
|
||||||
|
|
||||||
virJSONValuePtr
|
virJSONValuePtr
|
||||||
qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon)
|
qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon,
|
||||||
|
bool nodenames)
|
||||||
{
|
{
|
||||||
virJSONValuePtr cmd;
|
virJSONValuePtr cmd;
|
||||||
virJSONValuePtr reply = NULL;
|
virJSONValuePtr reply = NULL;
|
||||||
virJSONValuePtr ret = NULL;
|
virJSONValuePtr ret = NULL;
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats", NULL)))
|
if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats",
|
||||||
|
"B:query-nodes", nodenames,
|
||||||
|
NULL)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
@ -2385,7 +2388,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
|
|||||||
size_t i;
|
size_t i;
|
||||||
virJSONValuePtr devices;
|
virJSONValuePtr devices;
|
||||||
|
|
||||||
if (!(devices = qemuMonitorJSONQueryBlockstats(mon)))
|
if (!(devices = qemuMonitorJSONQueryBlockstats(mon, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < virJSONValueArraySize(devices); i++) {
|
for (i = 0; i < virJSONValueArraySize(devices); i++) {
|
||||||
|
@ -86,7 +86,8 @@ int qemuMonitorJSONSetMemoryStatsPeriod(qemuMonitorPtr mon,
|
|||||||
int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
|
int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
|
||||||
virHashTablePtr table);
|
virHashTablePtr table);
|
||||||
|
|
||||||
virJSONValuePtr qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon);
|
virJSONValuePtr qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon,
|
||||||
|
bool nodenames);
|
||||||
int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
|
int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
|
||||||
virHashTablePtr hash,
|
virHashTablePtr hash,
|
||||||
bool backingChain);
|
bool backingChain);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user