Bug 846013 - Support migration with IPv6 addresses
Summary: Support migration with IPv6 addresses
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
Keywords: ZStream
Depends On:
Blocks: 950597
TreeView+ depends on / blocked
Reported: 2012-08-06 13:50 UTC by Jiri Denemark
Modified: 2018-12-01 17:22 UTC (History)
14 users (show)

Previously, due to several issues, IPv6 was not handled properly during migration. With this update, migrations now succeed in the described scenario.
Clone Of:
Last Closed: 2013-11-21 08:30:10 UTC

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

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1581 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2013-11-21 01:11:35 UTC

Description Jiri Denemark 2012-08-06 13:50:08 UTC
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 07:41:04 UTC
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 15:51:41 UTC
I proposed a fix upstream:


Comment 15 Ján Tomko 2013-04-10 08:42:36 UTC
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 13:03:02 UTC
Packages have been delivered to customer.

Waiting on customer testing feedback

Comment 23 weizhang 2013-07-10 08:53:44 UTC
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 08:57:13 UTC
Created attachment 771460 [details]
libvirtd.log for crash

Comment 25 Jiri Denemark 2013-07-10 09:15:24 UTC
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-11 02:54:54 UTC
Created attachment 771948 [details]

Comment 27 Ján Tomko 2013-07-11 08:11:19 UTC
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 06:07:46 UTC
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 08:30:10 UTC
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.