From 728c0e5df47b1d6528d6e2191bf974504bfc7a18 Mon Sep 17 00:00:00 2001 From: David Dai Date: Fri, 27 Jan 2017 09:01:43 -0600 Subject: [PATCH] qemu: Fix live migration over RDMA with IPv6 Using libvirt to do live migration over RDMA via IPv6 address failed. For example: rhel73_host1_guest1 qemu+ssh://[deba::2222]/system --verbose root@deba::2222's password: error: internal error: unable to execute QEMU command 'migrate': RDMA ERROR: could not rdma_getaddrinfo address deba As we can see, the IPv6 address used by rdma_getaddrinfo() has only "deba" part because we didn't properly enclose the IPv6 address in [] and passed rdma:deba::2222:49152 as the migration URI in qemuMonitorMigrateToHost. Signed-off-by: David Dai --- src/qemu/qemu_monitor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b7be5e7f47..1308b6921e 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2577,8 +2577,12 @@ qemuMonitorMigrateToHost(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - if (virAsprintf(&uri, "%s:%s:%d", protocol, hostname, port) < 0) + if (strchr(hostname, ':')) { + if (virAsprintf(&uri, "%s:[%s]:%d", protocol, hostname, port) < 0) + return -1; + } else if (virAsprintf(&uri, "%s:%s:%d", protocol, hostname, port) < 0) { return -1; + } if (mon->json) ret = qemuMonitorJSONMigrate(mon, flags, uri); -- 2.47.2