The event is fired when the domain memory only dump completes.
Wire up the code to extract and send along the status.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_monitor.c | 18 ++++++++++++++++++
src/qemu/qemu_monitor.h | 19 +++++++++++++++++++
src/qemu/qemu_monitor_json.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 046caf001..99f73bf1c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -202,6 +202,10 @@ VIR_ENUM_IMPL(qemuMonitorBlockIOStatus,
QEMU_MONITOR_BLOCK_IO_STATUS_LAST,
"ok", "failed", "nospace")
+VIR_ENUM_IMPL(qemuMonitorDumpStatus,
+ QEMU_MONITOR_DUMP_STATUS_LAST,
+ "none", "active", "completed",
"failed")
+
char *
qemuMonitorEscapeArg(const char *in)
{
@@ -1656,6 +1660,20 @@ qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
int
+qemuMonitorEmitDumpCompleted(qemuMonitorPtr mon,
+ qemuMonitorDumpStatus status)
+{
+ int ret = -1;
+
+ VIR_DEBUG("mon=%p", mon);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainDumpCompleted, mon->vm, status);
+
+ return ret;
+}
+
+
+int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
QEMU_CHECK_MONITOR(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 67b785e60..f2ac71071 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -246,6 +246,21 @@ typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr
mon,
unsigned long long excess,
void *opaque);
+typedef enum {
+ QEMU_MONITOR_DUMP_STATUS_NONE,
+ QEMU_MONITOR_DUMP_STATUS_ACTIVE,
+ QEMU_MONITOR_DUMP_STATUS_COMPLETED,
+ QEMU_MONITOR_DUMP_STATUS_FAILED,
+
+ QEMU_MONITOR_DUMP_STATUS_LAST,
+} qemuMonitorDumpStatus;
+
+VIR_ENUM_DECL(qemuMonitorDumpStatus)
+
+typedef int (*qemuMonitorDomainDumpCompletedCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ qemuMonitorDumpStatus status,
+ void *opaque);
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
@@ -279,6 +294,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainMigrationPassCallback domainMigrationPass;
qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
+ qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -408,6 +424,9 @@ int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
unsigned long long threshold,
unsigned long long excess);
+int qemuMonitorEmitDumpCompleted(qemuMonitorPtr mon,
+ qemuMonitorDumpStatus status);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5ddd85575..169c01205 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -90,6 +90,7 @@ static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon,
virJSONValu
static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSONValuePtr
data);
static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr
data);
+static void qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, virJSONValuePtr
data);
typedef struct {
const char *type;
@@ -106,6 +107,7 @@ static qemuEventHandler eventHandlers[] = {
{ "BLOCK_WRITE_THRESHOLD", qemuMonitorJSONHandleBlockThreshold, },
{ "DEVICE_DELETED", qemuMonitorJSONHandleDeviceDeleted, },
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
+ { "DUMP_COMPLETED", qemuMonitorJSONHandleDumpCompleted, },
{ "GUEST_PANICKED", qemuMonitorJSONHandleGuestPanic, },
{ "MIGRATION", qemuMonitorJSONHandleMigrationStatus, },
{ "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, },
@@ -1143,6 +1145,35 @@ qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon,
virJSONValuePtr data)
}
+static void
+qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon,
+ virJSONValuePtr data)
+{
+ const char *statusstr;
+ qemuMonitorDumpStatus status;
+ virJSONValuePtr result;
+
+ if (!(result = virJSONValueObjectGetObject(data, "result"))) {
+ VIR_WARN("missing result in dump completed event");
+ return;
+ }
+
+ if (!(statusstr = virJSONValueObjectGetString(result, "status"))) {
+ VIR_WARN("missing status string in dump completed event");
+ return;
+ }
+
+ status = qemuMonitorDumpStatusTypeFromString(statusstr);
+ if (status < 0) {
+ VIR_WARN("invalid status string '%s' in dump completed event",
+ statusstr);
+ return;
+ }
+
+ qemuMonitorEmitDumpCompleted(mon, status);
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
--
2.13.6