My commit 674afcb09e3d33500cfbbcf870ebf92cb99ecfa3 moved computing the
default listen address from qemuMigrationPrepareAny to
qemuMigrationPrepareIncoming. However, I didn't notice listenAddress was
later passed to qemuMigrationStartNBDServer. Thus, it would be called
with the original value of listenAddress (NULL).

Let's add the updated listen address to qemuProcessIncomingDef and use
it when starting NBD servers.

Reported-by: Michael Chapman <m...@very.puzzling.org>
Signed-off-by: Jiri Denemark <jdene...@redhat.com>
---
 src/qemu/qemu_migration.c | 5 +++--
 src/qemu/qemu_process.c   | 7 ++++++-
 src/qemu/qemu_process.h   | 2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6be11b4..cb8c75d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3365,7 +3365,8 @@ qemuMigrationPrepareIncoming(virDomainObjPtr vm,
             goto cleanup;
     }
 
-    inc = qemuProcessIncomingDefNew(priv->qemuCaps, migrateFrom, fd, NULL);
+    inc = qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress,
+                                    migrateFrom, fd, NULL);
 
  cleanup:
     VIR_FREE(migrateFrom);
@@ -3586,7 +3587,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
     if (mig->nbd &&
         flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NBD_SERVER)) {
-        if (qemuMigrationStartNBDServer(driver, vm, listenAddress,
+        if (qemuMigrationStartNBDServer(driver, vm, incoming->address,
                                         nmigrate_disks, migrate_disks) < 0) {
             goto stopjob;
         }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f274068..819ad05 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4124,6 +4124,7 @@ qemuProcessIncomingDefFree(qemuProcessIncomingDefPtr inc)
     if (!inc)
         return;
 
+    VIR_FREE(inc->address);
     VIR_FREE(inc->launchURI);
     VIR_FREE(inc->deferredURI);
     VIR_FREE(inc);
@@ -4137,6 +4138,7 @@ qemuProcessIncomingDefFree(qemuProcessIncomingDefPtr inc)
  */
 qemuProcessIncomingDefPtr
 qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
+                          const char *listenAddress,
                           const char *migrateFrom,
                           int fd,
                           const char *path)
@@ -4149,6 +4151,9 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
     if (VIR_ALLOC(inc) < 0)
         return NULL;
 
+    if (VIR_STRDUP(inc->address, listenAddress) < 0)
+        goto error;
+
     inc->launchURI = qemuMigrationIncomingURI(migrateFrom, fd);
     if (!inc->launchURI)
         goto error;
@@ -5137,7 +5142,7 @@ qemuProcessStart(virConnectPtr conn,
         goto cleanup;
 
     if (migrateFrom) {
-        incoming = qemuProcessIncomingDefNew(priv->qemuCaps, migrateFrom,
+        incoming = qemuProcessIncomingDefNew(priv->qemuCaps, NULL, migrateFrom,
                                              migrateFd, migratePath);
         if (!incoming)
             goto stop;
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 85e3a06..c674111 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -47,6 +47,7 @@ int qemuProcessAssignPCIAddresses(virDomainDefPtr def);
 typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;
 typedef qemuProcessIncomingDef *qemuProcessIncomingDefPtr;
 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 */
     int fd; /* for fd:N URI */
@@ -54,6 +55,7 @@ struct _qemuProcessIncomingDef {
 };
 
 qemuProcessIncomingDefPtr qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
+                                                    const char *listenAddress,
                                                     const char *migrateFrom,
                                                     int fd,
                                                     const char *path);
-- 
2.7.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to