Red Hat Bugzilla – Bug 1025407
autoport='yes' doesn't skip over ports in use with IPv6
Last modified: 2016-04-26 11:42:01 EDT
Description of problem: autoport='yes' doesn't skip over ports in use with IPv6 Version-Release number of selected component (if applicable): libvirt-1.1.1-10.el7 How reproducible: 100% Steps to Reproduce: 1. Listen on IPv6-only on the first display port without libvirtd's knowlege. Either: a) start a domain with <graphics listen="::1" autoport="yes"> and restart libvirtd or b) nc -6 -l -p 5900 2. Try to start another domain with <graphics listen="::1" autoport="yes"> Actual results: error: Failed to start domain f19live error: internal error: process exited while connecting to monitor: ((null):15085): Spice-Warning **: reds.c:3037:reds_init_socket: reds_init_socket: binding socket to ::1:5900 failed qemu-kvm: failed to initialize spice server Expected results: Another port is assigned and domain starts successfully. Additional info: v1 of the patches proposed upstream: https://www.redhat.com/archives/libvir-list/2013-October/msg00007.html
v2 posted upstream: https://www.redhat.com/archives/libvir-list/2013-October/msg01313.html
v3 of the patchset: https://www.redhat.com/archives/libvir-list/2014-February/msg00325.html Now pushed upstream: commit 0ee9081215be8a11a5b31c5442b039d12466a0ae Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2014-02-14 13:18:35 +0100 Support IPv6 in port allocator Also try to bind on IPv6 to check if the port is occupied. Change the mocked bind in the test to return EADDRINUSE for some ports only for the IPv4/IPv6 socket if we're testing on a host with IPv6 compiled in. Also mock socket() to make it fail with EAFNOTSUPPORTED if LIBVIRT_TEST_IPV4ONLY is set in the environment, to simulate a host without IPv6 support in the kernel. The tests are repeated again with this variable set. https://bugzilla.redhat.com/show_bug.cgi?id=1025407 commit 531bc0bbd049a22141af98e833abe8acfd610585 Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2014-02-14 13:18:35 +0100 Split out bind() from virPortAllocatorAcquire git describe: v1.2.1-213-g0ee9081
I can reproduce this bug with libvirt-1.1.1-29.el7.x86_64: # virsh dumpxml etsd|grep ::1 <graphics type='spice' port='5900' autoport='yes' listen='::1'> <listen type='address' address='::1'/> # virsh dumpxml etsd2|grep ::1 <graphics type='spice' autoport='yes' listen='::1'> <listen type='address' address='::1'/> # virsh start etsd Domain etsd started # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh start etsd2 error: Failed to start domain etsd2 error: internal error: process exited while connecting to monitor: ((null):16242): Spice-Warning **: reds.c:3070:reds_init_socket: reds_init_socket: binding socket to ::1:5900 failed qemu-kvm: failed to initialize spice server And verify this bug with libvirt-1.2.8-7.el7.x86_64 : # virsh dumpxml etsd|grep ::1 <graphics type='spice' port='5900' autoport='yes' listen='::1'> <listen type='address' address='::1'/> # virsh dumpxml etsd2|grep ::1 <graphics type='spice' autoport='yes' listen='::1'> <listen type='address' address='::1'/> # virsh start etsd Domain etsd started # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh start etsd2 Domain etsd2 started Also test with vnc.
Forgot this : # virsh start etsd2 Domain etsd2 started # netstat -ntap|grep qemu tcp6 0 0 ::1:5900 :::* LISTEN 17671/qemu-kvm tcp6 0 0 ::1:5901 :::* LISTEN 17805/qemu-kvm
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. https://rhn.redhat.com/errata/RHSA-2015-0323.html