qemu: Fix NBD migration with default listenAddress

My commit 674afcb09e 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 <mike@very.puzzling.org>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-01-08 00:07:37 +01:00
parent aa7735e9d1
commit f87668b70e
3 changed files with 11 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);