On Fri, Mar 22, 2013 at 08:06:00PM +0100, Ján Tomko wrote: > Allow migration over IPv6 by listening on [::] instead of 0.0.0.0 > when QEMU supports it (QEMU_CAPS_IPV6_MIGRATION) and there is > at least one v6 address configured on the system. > > Use virURIParse in qemuMigrationPrepareDirect to allow parsing > IPv6 addresses, which would cause an 'incorrect :port' error > message before. > > Move setting of migrateFrom from qemuMigrationPrepare{Direct,Tunnel} > after domain XML parsing, since we need the QEMU binary path from it > to get its capabilities. > > Bug: https://bugzilla.redhat.com/show_bug.cgi?id=846013 > --- > > diff to v4: > Always listen on IPv6 if it's available. > Don't add a migration flag. > > v4: > https://www.redhat.com/archives/libvir-list/2013-March/msg01213.html > > discussion: > https://www.redhat.com/archives/libvir-list/2013-March/msg00515.html > > src/qemu/qemu_capabilities.c | 6 +++ > src/qemu/qemu_capabilities.h | 1 + > src/qemu/qemu_migration.c | 104 > +++++++++++++++++++++++++++++++++---------- > tests/qemuhelptest.c | 9 ++-- > 4 files changed, 93 insertions(+), 27 deletions(-)
ACK > @@ -2084,6 +2088,45 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, > } > } > > + if (tunnel) { > + /* QEMU will be started with -incoming stdio > + * (which qemu_command might convert to exec:cat or fd:n) > + */ > + if (!(migrateFrom = strdup("stdio"))) { > + virReportOOMError(); > + goto cleanup; > + } > + } else { > + virQEMUCapsPtr qemuCaps = NULL; > + struct addrinfo *info = NULL; > + struct addrinfo hints = { .ai_flags = AI_ADDRCONFIG, > + .ai_socktype = SOCK_STREAM }; > + > + if (!(qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache, > + def->emulator))) > + goto cleanup; > + > + /* Listen on :: instead of 0.0.0.0 if QEMU understands it > + * and there is at least one IPv6 address configured > + */ > + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION) && > + getaddrinfo("::", NULL, &hints, &info) == 0) { > + freeaddrinfo(info); > + listenAddr = "[::]"; > + } else { > + listenAddr = "0.0.0.0"; > + } > + virObjectUnref(qemuCaps); > + > + /* QEMU will be started with -incoming [::]:port > + * or -incoming 0.0.0.0:port > + */ > + if (virAsprintf(&migrateFrom, "tcp:%s:%d", listenAddr, port) < 0) { > + virReportOOMError(); > + goto cleanup; > + } > + } It is a little gross that we're doing this command line construction code in here and not in qemu_command.c qemuBuildCommandLine() method, but we can live with that for now Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list