A literal IPv6 must be escaped, otherwise migration fails with: unable to execute QEMU command 'drive-mirror': address resolution failed for f0::0d:5901: Servname not supported for ai_socktype since QEMU treats everything after the first ':' as the port. --- src/qemu/qemu_migration.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ffc86a4..7aa0476 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1193,6 +1193,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, size_t i, lastGood = 0; char *diskAlias = NULL; char *nbd_dest = NULL; + char *hoststr = NULL; unsigned int mirror_flags = VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT; virErrorPtr err = NULL; @@ -1212,6 +1213,16 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, port = mig->nbd->port; mig->nbd->port = 0; + /* escape literal IPv6 address */ + if (strchr(host, ':')) { + if (virAsprintf(&hoststr, "[%s]", host) < 0) { + virReportOOMError(); + goto error; + } + } else if (VIR_STRDUP(hoststr, host) < 0) { + goto error; + } + if (*migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC) mirror_flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW; @@ -1228,7 +1239,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, if ((virAsprintf(&diskAlias, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) || (virAsprintf(&nbd_dest, "nbd:%s:%d:exportname=%s", - host, port, diskAlias) < 0)) { + hoststr, port, diskAlias) < 0)) { virReportOOMError(); goto error; } @@ -1297,6 +1308,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, cleanup: VIR_FREE(diskAlias); VIR_FREE(nbd_dest); + VIR_FREE(hoststr); return ret; error: -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list