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(a)redhat.com>
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_monitor.c | 10 ++++++++++
src/qemu/qemu_monitor.h | 3 +++
src/qemu/qemu_monitor_json.c | 39 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 3 +++
4 files changed, 55 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index f4edfc36b..fd19699af 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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.
*/
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index d23514b36..83187599a 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e9b407aa4..0acce144c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 739a99293..2f59518ba 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -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);
--
2.13.6