mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Introduce qemuMonitor[JSON]QueryDump
Add the query-dump API's in order to allow the dump-guest-memory to be used to monitor progress. This will use the dump stats extraction helper to fill a return buffer. Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
3455a7359c
commit
88c2360753
@ -2775,6 +2775,16 @@ qemuMonitorMigrateCancel(qemuMonitorPtr mon)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorQueryDump(qemuMonitorPtr mon,
|
||||
qemuMonitorDumpStatsPtr stats)
|
||||
{
|
||||
QEMU_CHECK_MONITOR_JSON(mon);
|
||||
|
||||
return qemuMonitorJSONQueryDump(mon, stats);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns 1 if @capability is supported, 0 if it's not, or -1 on error.
|
||||
*/
|
||||
|
@ -790,6 +790,9 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon);
|
||||
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
|
||||
const char *capability);
|
||||
|
||||
int qemuMonitorQueryDump(qemuMonitorPtr mon,
|
||||
qemuMonitorDumpStatsPtr stats);
|
||||
|
||||
int qemuMonitorDumpToFd(qemuMonitorPtr mon,
|
||||
int fd,
|
||||
const char *dumpformat);
|
||||
|
@ -3165,6 +3165,45 @@ int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* qemuMonitorJSONQueryDump:
|
||||
* @mon: Monitor pointer
|
||||
* @stats: Monitor dump stats
|
||||
*
|
||||
* Attempt to make a "query-dump" call, check for errors, and get/return
|
||||
* the current from the reply
|
||||
*
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
qemuMonitorJSONQueryDump(qemuMonitorPtr mon,
|
||||
qemuMonitorDumpStatsPtr stats)
|
||||
{
|
||||
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-dump", NULL);
|
||||
virJSONValuePtr reply = NULL;
|
||||
virJSONValuePtr result = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (!cmd)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
result = virJSONValueObjectGetObject(reply, "return");
|
||||
|
||||
ret = qemuMonitorJSONExtractDumpStats(result, stats);
|
||||
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
|
||||
const char *capability)
|
||||
|
@ -162,6 +162,9 @@ int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorPtr mon,
|
||||
|
||||
int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorJSONQueryDump(qemuMonitorPtr mon,
|
||||
qemuMonitorDumpStatsPtr stats);
|
||||
|
||||
int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
|
||||
const char *capability);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user