[libvirt] [PATCH 1/2] qemu: clean out unused migrate to unix

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Tue Dec 20 07:05:49 UTC 2016


---
 src/qemu/qemu_migration.c | 40 ++--------------------------------------
 src/qemu/qemu_monitor.c   | 24 ------------------------
 src/qemu/qemu_monitor.h   |  4 ----
 3 files changed, 2 insertions(+), 66 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2e570e6..0f4a6cf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4355,7 +4355,6 @@ qemuMigrationConfirm(virConnectPtr conn,
 enum qemuMigrationDestinationType {
     MIGRATION_DEST_HOST,
     MIGRATION_DEST_CONNECT_HOST,
-    MIGRATION_DEST_UNIX,
     MIGRATION_DEST_FD,
 };
 
@@ -4376,11 +4375,6 @@ struct _qemuMigrationSpec {
         } host;
 
         struct {
-            char *file;
-            int sock;
-        } unix_socket;
-
-        struct {
             int qemu;
             int local;
         } fd;
@@ -4816,11 +4810,6 @@ qemuMigrationRun(virQEMUDriverPtr driver,
         /* 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;
@@ -4840,25 +4829,6 @@ qemuMigrationRun(virQEMUDriverPtr driver,
     /* 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;
@@ -5081,7 +5051,6 @@ static int doTunnelMigrate(virQEMUDriverPtr driver,
                            qemuMigrationCompressionPtr compression,
                            qemuMonitorMigrationParamsPtr migParams)
 {
-    virNetSocketPtr sock = NULL;
     int ret = -1;
     qemuMigrationSpec spec;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
@@ -5120,13 +5089,8 @@ static int doTunnelMigrate(virQEMUDriverPtr 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;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 648168d..815610b 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2622,30 +2622,6 @@ qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
 
 
 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)
 {
     QEMU_CHECK_MONITOR(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4d7fb9f..dce516a 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -682,10 +682,6 @@ int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
                                 unsigned int flags,
                                 const char * const *argv);
 
-int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
-                             unsigned int flags,
-                             const char *unixfile);
-
 int qemuMonitorMigrateCancel(qemuMonitorPtr mon);
 
 int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
-- 
1.8.3.1




More information about the libvir-list mailing list