Bug 846013 - Support migration with IPv6 addresses
Support migration with IPv6 addresses
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.3
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:
Environment:
Last Closed: 2013-11-21 03:30:10 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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
addresses:

        /* 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) {
                virReportOOMError();
                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)) {
                virReportError(VIR_ERR_INVALID_ARG,
                               "%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:0.0.0.0:port */
    snprintf(migrateFrom, sizeof(migrateFrom), "tcp:0.0.0.0:%d", this_port);


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

libvirt-0.10.0-0rc0.el6.x86_64

How reproducible:

100%

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:192.168.123.12
Comment 1 Jiri Denemark 2012-08-16 03:41:04 EDT
The last line from the code snippet

    snprintf(migrateFrom, sizeof(migrateFrom), "tcp:0.0.0.0:%d", this_port);

reveals another issue we have in IPv6 migrations. We tell qemu to listen on 0.0.0.0, 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:

https://www.redhat.com/archives/libvir-list/2013-February/msg00931.html
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 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.
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 
qemu-kvm-rhev-0.12.1.2-2.377.el6.x86_64
kernel-2.6.32-396.el6.x86_64
libvirt-0.10.2-19.el6.x86_64


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]
backtrace
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 
libvirt-0.10.2-21.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.379.el6.x86_64
kernel-2.6.32-398.el6.x86_64


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.

http://rhn.redhat.com/errata/RHBA-2013-1581.html

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