[libvirt PATCH 1/2] qemu: Simplify qemuProcessIncomingDef

Jiri Denemark jdenemar at redhat.com
Fri Apr 8 06:37:00 UTC 2022


All QEMU releases currently supported by libvirt already understand
"-incoming defer". We can drop the code handling "-incoming URI".

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c |  3 +--
 src/qemu/qemu_process.c   | 22 +++++++---------------
 src/qemu/qemu_process.h   |  3 +--
 3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 98f82abe7c..30a6202d85 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3040,8 +3040,7 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
         VIR_DEBUG("Received no lockstate");
     }
 
-    if (incoming->deferredURI &&
-        qemuMigrationDstRun(driver, vm, incoming->deferredURI,
+    if (qemuMigrationDstRun(driver, vm, incoming->uri,
                             VIR_ASYNC_JOB_MIGRATION_IN) < 0)
         goto stopjob;
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 995737ce86..2e11d24be2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4559,8 +4559,7 @@ qemuProcessIncomingDefFree(qemuProcessIncomingDef *inc)
         return;
 
     g_free(inc->address);
-    g_free(inc->launchURI);
-    g_free(inc->deferredURI);
+    g_free(inc->uri);
     g_free(inc);
 }
 
@@ -4589,15 +4588,10 @@ qemuProcessIncomingDefNew(virQEMUCaps *qemuCaps,
 
     inc->address = g_strdup(listenAddress);
 
-    inc->launchURI = qemuMigrationDstGetURI(migrateFrom, fd);
-    if (!inc->launchURI)
+    inc->uri = qemuMigrationDstGetURI(migrateFrom, fd);
+    if (!inc->uri)
         goto error;
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_INCOMING_DEFER)) {
-        inc->deferredURI = inc->launchURI;
-        inc->launchURI = g_strdup("defer");
-    }
-
     inc->fd = fd;
     inc->path = path;
 
@@ -7373,12 +7367,11 @@ qemuProcessLaunch(virConnectPtr conn,
     unsigned long long maxMemLock = 0;
 
     VIR_DEBUG("conn=%p driver=%p vm=%p name=%s if=%d asyncJob=%d "
-              "incoming.launchURI=%s incoming.deferredURI=%s "
+              "incoming.uri=%s "
               "incoming.fd=%d incoming.path=%s "
               "snapshot=%p vmop=%d flags=0x%x",
               conn, driver, vm, vm->def->name, vm->def->id, asyncJob,
-              NULLSTR(incoming ? incoming->launchURI : NULL),
-              NULLSTR(incoming ? incoming->deferredURI : NULL),
+              NULLSTR(incoming ? incoming->uri : NULL),
               incoming ? incoming->fd : -1,
               NULLSTR(incoming ? incoming->path : NULL),
               snapshot, vmop, flags);
@@ -7429,7 +7422,7 @@ qemuProcessLaunch(virConnectPtr conn,
     VIR_DEBUG("Building emulator command line");
     if (!(cmd = qemuBuildCommandLine(driver,
                                      vm,
-                                     incoming ? incoming->launchURI : NULL,
+                                     incoming ? "defer" : NULL,
                                      snapshot, vmop,
                                      false,
                                      qemuCheckFips(vm),
@@ -7856,8 +7849,7 @@ qemuProcessStart(virConnectPtr conn,
     relabel = true;
 
     if (incoming) {
-        if (incoming->deferredURI &&
-            qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0)
+        if (qemuMigrationDstRun(driver, vm, incoming->uri, asyncJob) < 0)
             goto stop;
     } else {
         /* Refresh state of devices from QEMU. During migration this happens
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 85c197714a..f81bfd930a 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -52,8 +52,7 @@ void qemuProcessReconnectAll(virQEMUDriver *driver);
 typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;
 struct _qemuProcessIncomingDef {
     char *address; /* address where QEMU is supposed to listen */
-    char *launchURI; /* used as a parameter for -incoming command line option */
-    char *deferredURI; /* used when calling migrate-incoming QMP command */
+    char *uri; /* used when calling migrate-incoming QMP command */
     int fd; /* for fd:N URI */
     const char *path; /* path associated with fd */
 };
-- 
2.35.1



More information about the libvir-list mailing list