enum qemuMigrationDestinationType {
MIGRATION_DEST_HOST,
MIGRATION_DEST_CONNECT_HOST,
- MIGRATION_DEST_UNIX,
MIGRATION_DEST_FD,
};
int port;
} host;
- struct {
- char *file;
- int sock;
- } unix_socket;
-
struct {
int qemu;
int local;
/* handled above and transformed into MIGRATION_DEST_FD */
break;
- case MIGRATION_DEST_UNIX:
- ret = qemuMonitorMigrateToUnix(priv->mon, migrate_flags,
- spec->dest.unix_socket.file);
- break;
-
case MIGRATION_DEST_FD:
if (spec->fwdType != MIGRATION_FWD_DIRECT) {
fd = spec->dest.fd.local;
/* From this point onwards we *must* call cancel to abort the
* migration on source if anything goes wrong */
- if (spec->destType == MIGRATION_DEST_UNIX) {
- /* It is also possible that the migrate didn't fail initially, but
- * rather failed later on. Check its status before waiting for a
- * connection from qemu which may never be initiated.
- */
- if (qemuMigrationCheckJobStatus(driver, vm,
- QEMU_ASYNC_JOB_MIGRATION_OUT,
- false) < 0)
- goto cancel;
-
- while ((fd = accept(spec->dest.unix_socket.sock, NULL, NULL)) < 0) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- virReportSystemError(errno, "%s",
- _("failed to accept connection from qemu"));
- goto cancel;
- }
- }
-
if (spec->fwdType != MIGRATION_FWD_DIRECT) {
if (!(iothread = qemuMigrationStartTunnel(spec->fwd.stream, fd)))
goto cancel;
qemuMigrationCompressionPtr compression,
qemuMonitorMigrationParamsPtr migParams)
{
- virNetSocketPtr sock = NULL;
int ret = -1;
qemuMigrationSpec spec;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
compression, migParams);
cleanup:
- if (spec.destType == MIGRATION_DEST_FD) {
- VIR_FORCE_CLOSE(spec.dest.fd.qemu);
- VIR_FORCE_CLOSE(spec.dest.fd.local);
- } else {
- virObjectUnref(sock);
- VIR_FREE(spec.dest.unix_socket.file);
- }
+ VIR_FORCE_CLOSE(spec.dest.fd.qemu);
+ VIR_FORCE_CLOSE(spec.dest.fd.local);
virObjectUnref(cfg);
return ret;
}
-int
-qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
- unsigned int flags,
- const char *unixfile)
-{
- char *dest = NULL;
- int ret = -1;
- VIR_DEBUG("unixfile=%s flags=%x", unixfile, flags);
-
- QEMU_CHECK_MONITOR(mon);
-
- if (virAsprintf(&dest, "unix:%s", unixfile) < 0)
- return -1;
-
- if (mon->json)
- ret = qemuMonitorJSONMigrate(mon, flags, dest);
- else
- ret = qemuMonitorTextMigrate(mon, flags, dest);
-
- VIR_FREE(dest);
- return ret;
-}
-
-
int
qemuMonitorMigrateCancel(qemuMonitorPtr mon)
{