Bug 846013 - Support migration with IPv6 addresses
Support migration with IPv6 addresses
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
high Severity high
: rc
: ---
Assigned To: Ján Tomko
Virtualization Bugs
: ZStream
Depends On:
Blocks: 950597
  Show dependency treegraph
Reported: 2012-08-06 09:50 EDT by Jiri Denemark
Modified: 2013-11-21 03:30 EST (History)
14 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-19.el6
Doc Type: Bug Fix
Doc Text:
Previously, due to several issues, IPv6 was not handled properly during migration. With this update, migrations now succeed in the described scenario.
Story Points: ---
Clone Of:
Last Closed: 2013-11-21 03:30:10 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
libvirtd.log for crash (65.38 KB, text/plain)
2013-07-10 04:57 EDT, weizhang
no flags Details
backtrace (10.68 KB, text/plain)
2013-07-10 22:54 EDT, weizhang
no flags Details

  None (edit)
Description Jiri Denemark 2012-08-06 09:50:08 EDT
Description of problem:

URI parsing/formating in qemuMigrationPrepareDirect is not ready for IPv6

        /* Get the port number. */
        p = strrchr (uri_in, ':');
        if (p == strchr(uri_in, ':')) {
            /* Generate a port */
            this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
            if (port == QEMUD_MIGRATION_NUM_PORTS)
                port = 0;

            /* Caller frees */
            if (virAsprintf(uri_out, "%s:%d", uri_in, this_port) < 0) {
                goto cleanup;

        } else {
            p++; /* definitely has a ':' in it, see above */
            this_port = virParseNumber (&p);
            if (this_port == -1 || p-uri_in != strlen (uri_in)) {
                               "%s", _("URI ended with incorrect ':port'"));
                goto cleanup;

    if (*uri_out)
        VIR_DEBUG("Generated uri_out=%s", *uri_out);

    /* QEMU will be started with -incoming tcp: */
    snprintf(migrateFrom, sizeof(migrateFrom), "tcp:", this_port);

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. virsh migrate qemu qemu+tcp://host2/system tcp:[fec0::2]
Actual results:

virsh # migrate qemu qemu+tcp://host2/system tcp:[fec0::2]
error: invalid argument: URI ended with incorrect ':port'

Additional info:

Using IPv4 address, migration works as expected:

virsh # migrate qemu qemu+tcp://host2/system tcp:
Comment 1 Jiri Denemark 2012-08-16 03:41:04 EDT
The last line from the code snippet

    snprintf(migrateFrom, sizeof(migrateFrom), "tcp:", this_port);

reveals another issue we have in IPv6 migrations. We tell qemu to listen on, that is, IPv4 only. We should allow it to listen on IPv6 as well, however, we need to do something more clever than tcp:[::]:%d since this wouldn't work if IPv6 was explicitly disabled on the host.
Comment 11 Ján Tomko 2013-02-18 10:51:41 EST
I proposed a fix upstream:

Comment 15 Ján Tomko 2013-04-10 04:42:36 EDT
Fixed upstream by:
commit f03dcc5df141370c09da93135ad2f921c0af55b9
Author:     Ján Tomko <jtomko@redhat.com>
AuthorDate: 2013-03-22 14:52:25 +0100
Commit:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2013-04-02 11:23:47 +0200

    qemu: Allow migration over IPv6
    Allow migration over IPv6 by listening on [::] instead of
    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.
Comment 20 Fabio Massimo Di Nitto 2013-04-10 09:03:02 EDT
Packages have been delivered to customer.

Waiting on customer testing feedback
Comment 23 weizhang 2013-07-10 04:53:44 EDT
Test on 

When do migration with
#virsh migrate mig qemu+tcp://test2/system tcp:[3ffe::102]
error: End of file while reading data: Input/output error

The target libvirtd crash
the dumping log will be attached
Comment 24 weizhang 2013-07-10 04:57:13 EDT
Created attachment 771460 [details]
libvirtd.log for crash
Comment 25 Jiri Denemark 2013-07-10 05:15:24 EDT
According to the log, it looks like the crash is similar to bug 982544. Could you provide backtrace of all libvirtd's threads when the deamon crashed?
Comment 26 weizhang 2013-07-10 22:54:54 EDT
Created attachment 771948 [details]
Comment 27 Ján Tomko 2013-07-11 04:11:19 EDT
This is the same crash as in bug 982544.

As Jiri Denemark said there:
> The backtrace shows libvirtd crashed as a result of a bug introduced by a
> patch for 977961. This regression is fixed by a follow-up patch mentioned in
> https://bugzilla.redhat.com/show_bug.cgi?id=977961#c8
Comment 28 weizhang 2013-07-29 02:07:46 EDT
Verify pass on 

Migration with 
#virsh migrate mig qemu+tcp://test2/system tcp:[3ffe::102]

can succeed without error
Comment 30 errata-xmlrpc 2013-11-21 03:30:10 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.