Description of problem: When two KVM guests have VNC monitor defined to listen on different address but on same port creation of other than the first guest fails with "Failed to reserve port 5900". Version-Release number of selected component (if applicable): 1.2.8-16.el7_1.2.x86_64 How reproducible: Always Steps to Reproduce: 1. Add two different addresses to some interface eg: # ip ad add 127.0.1.1/8 dev lo # ip ad add 127.0.1.2/8 dev lo 2. Create two KVM guests using these addresses and port 5900 for VNC monitor. eg: ... <graphics type='vnc' port='5900' autoport='no' listen='127.0.1.1' passwd='1SsGxoKT'> <listen type='address' address='127.0.1.1'/> </graphics> ... 3. Start first guest 4. Start second guest Actual results: When trying to start the second guest, libvirt fails with: error: Failed to start domain error: internal error: Failed to reserve port 5900 Expected results: Both guests start Additional info: The actual bug seems to be that virportallocator does not deal with the situation that user specifies listen address for the vnc monitor. I dug a litle into this and found changes in src/util/virportallocator.c between 7.0 and 7.1 release caused this. The bug existed before, it was only skipped when the socket could be binded successfully. IMHO the easiest fix would be to ignore "duplicate" port reservations provided that the socket is free and bindable. I am not sure if that breaks automatic assignment of ports or something else though. This may be related to #1081881
Moving to RHEL-7.3, it's not a critical bug.
Created attachment 1519421 [details] Patch to disable port allocator for qemu VNC display
This prevails in 7.6 even though virPortAllocator has been rewritten in libvirt 4.5 I have added a patch that adds a configuration option to disable port allocation bitmap for qemu VNC.
There's an upstream reincarnation of this bug - see bug 1751969. I'll just repeat here what I said there - the only possible fix that would work is if libvirt would bind() to the address + port itself and then just passed FD to qemu.
This bug was closed deferred as a result of bug triage. Please reopen if you disagree and provide justification why this bug should get enough priority. Most important would be information about impact on customer or layered product. Please indicate requested target release.