Handle a DUMP_COMPLETED event processing the status, stats, and
error string. Use the @status in order to copy the error that
was generated whilst processing the @stats data. If an error was
provided by QEMU, then use that instead.
If there's no async job, we can just ignore the data.
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_domain.c | 2 ++
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_process.c | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a37012a10..662d02896 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -334,6 +334,8 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
job->spiceMigration = false;
job->spiceMigrated = false;
job->postcopyEnabled = false;
+ job->dumpCompleted = false;
+ VIR_FREE(job->error);
VIR_FREE(job->current);
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 0bdd98459..0d27ad57d 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -175,6 +175,8 @@ struct qemuDomainJobObj {
* should wait for it to finish */
bool spiceMigrated; /* spice migration completed */
bool postcopyEnabled; /* post-copy migration was enabled */
+ char *error; /* job event completion error */
+ bool dumpCompleted; /* dump completed */
};
typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 72f38aaf6..0d1ff4762 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1691,6 +1691,45 @@ qemuProcessHandleMigrationPass(qemuMonitorPtr mon
ATTRIBUTE_UNUSED,
}
+static int
+qemuProcessHandleDumpCompleted(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ int status,
+ qemuMonitorDumpStatsPtr stats,
+ const char *error,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ qemuDomainObjPrivatePtr priv;
+
+ virObjectLock(vm);
+
+ VIR_DEBUG("Dump completed for domain %p %s with stats=%p
error='%s'",
+ vm, vm->def->name, stats, NULLSTR(error));
+
+ priv = vm->privateData;
+ if (priv->job.asyncJob == QEMU_ASYNC_JOB_NONE) {
+ VIR_DEBUG("got DUMP_COMPLETED event without a dump_completed job");
+ goto cleanup;
+ }
+ priv->job.dumpCompleted = true;
+ priv->job.current->stats.dump = *stats;
+ ignore_value(VIR_STRDUP_QUIET(priv->job.error, error));
+
+ /* Force error if extracting the DUMP_COMPLETED status failed */
+ if (!error && status < 0) {
+ ignore_value(VIR_STRDUP_QUIET(priv->job.error, virGetLastErrorMessage()));
+ priv->job.current->stats.dump.status = QEMU_MONITOR_DUMP_STATUS_FAILED;
+ }
+
+ virDomainObjBroadcast(vm);
+
+ cleanup:
+ virResetLastError();
+ virObjectUnlock(vm);
+ return 0;
+}
+
+
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuProcessHandleMonitorEOF,
.errorNotify = qemuProcessHandleMonitorError,
@@ -1719,6 +1758,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainMigrationPass = qemuProcessHandleMigrationPass,
.domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
.domainBlockThreshold = qemuProcessHandleBlockThreshold,
+ .domainDumpCompleted = qemuProcessHandleDumpCompleted,
};
static void
--
2.13.6