qemuDomainAsyncJob asyncJob)
{
int ret = -1;
+ bool restored = false;
virObjectEventPtr event;
int intermediatefd = -1;
virCommandPtr cmd = NULL;
}
/* Set the migration source and start it up. */
- ret = qemuProcessStart(conn, driver, vm, asyncJob,
- "stdio", *fd, path, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
- VIR_QEMU_PROCESS_START_PAUSED);
+ if (qemuProcessStart(conn, driver, vm, asyncJob,
+ "stdio", *fd, path, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
+ VIR_QEMU_PROCESS_START_PAUSED) == 0)
+ restored = true;
if (intermediatefd != -1) {
- if (ret < 0) {
+ if (!restored) {
/* if there was an error setting up qemu, the intermediate
* process will wait forever to write to stdout, so we
* must manually kill it.
if (virCommandWait(cmd, NULL) < 0) {
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, 0);
- ret = -1;
+ restored = false;
}
VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf));
}
if (VIR_CLOSE(*fd) < 0) {
virReportSystemError(errno, _("cannot close file: %s"), path);
- ret = -1;
+ restored = false;
}
- if (ret < 0) {
- virDomainAuditStart(vm, "restored", false);
+ virDomainAuditStart(vm, "restored", restored);
+ if (!restored)
goto cleanup;
- }
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_RESTORED);
- virDomainAuditStart(vm, "restored", true);
qemuDomainEventQueue(driver, event);