mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Introduce qemuProcessHandleDumpCompleted
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>
This commit is contained in:
parent
fd1a9e5c56
commit
3455a7359c
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user