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:
John Ferlan 2017-11-20 15:02:59 -05:00
parent 3455a7359c
commit 88c2360753
4 changed files with 55 additions and 0 deletions

View File

@ -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. * Returns 1 if @capability is supported, 0 if it's not, or -1 on error.
*/ */

View File

@ -790,6 +790,9 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon);
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon, int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
const char *capability); const char *capability);
int qemuMonitorQueryDump(qemuMonitorPtr mon,
qemuMonitorDumpStatsPtr stats);
int qemuMonitorDumpToFd(qemuMonitorPtr mon, int qemuMonitorDumpToFd(qemuMonitorPtr mon,
int fd, int fd,
const char *dumpformat); const char *dumpformat);

View File

@ -3165,6 +3165,45 @@ int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon)
return ret; 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 int
qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon, qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
const char *capability) const char *capability)

View File

@ -162,6 +162,9 @@ int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorPtr mon,
int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon); int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon);
int qemuMonitorJSONQueryDump(qemuMonitorPtr mon,
qemuMonitorDumpStatsPtr stats);
int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon, int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
const char *capability); const char *capability);