提交 88c23607 编写于 作者: J John Ferlan

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: NJiri Denemark <jdenemar@redhat.com>
上级 3455a735
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册