]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Introduce qemuProcessHandleDumpCompleted
authorJohn Ferlan <jferlan@redhat.com>
Mon, 20 Nov 2017 14:51:22 +0000 (09:51 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 6 Feb 2018 12:37:32 +0000 (07:37 -0500)
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@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_process.c

index f484e98354e7ff931751f6de120461ef33a42774..dcaeff3ba89f120811550934f7102873fd0c2df2 100644 (file)
@@ -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);
 }
 
index 57c8d9ce79bb4e931c5d1605a8595a29328c56d6..25328cd110edbaf214aeb83bb67939673c304390 100644 (file)
@@ -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,
index 138a42b1dee3e0791f300b154a186bb6ef67aa77..c1da3bb7c84d352015829bc42cb56aae805e7fcf 100644 (file)
@@ -1677,6 +1677,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,
@@ -1705,6 +1744,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
     .domainMigrationPass = qemuProcessHandleMigrationPass,
     .domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
     .domainBlockThreshold = qemuProcessHandleBlockThreshold,
+    .domainDumpCompleted = qemuProcessHandleDumpCompleted,
 };
 
 static void