Bug 1209959 - Cannot start multiple guests with VNC monitor listening on same port (different address)
Summary: Cannot start multiple guests with VNC monitor listening on same port (differe...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Yanqiu Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-08 14:06 UTC by Jiri Lunacek
Modified: 2020-03-10 13:15 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-10 13:15:52 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to disable port allocator for qemu VNC display (2.51 KB, patch)
2019-01-09 10:03 UTC, Jiri Lunacek
no flags Details | Diff

Description Jiri Lunacek 2015-04-08 14:06:30 UTC
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

Comment 2 Pavel Hrdina 2015-07-15 13:27:57 UTC
Moving to RHEL-7.3, it's not a critical bug.

Comment 7 Jiri Lunacek 2019-01-09 10:03:45 UTC
Created attachment 1519421 [details]
Patch to disable port allocator for qemu VNC display

Comment 8 Jiri Lunacek 2019-01-09 10:05:27 UTC
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.

Comment 9 Michal Privoznik 2019-09-16 06:00:04 UTC
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.

Comment 10 Pavel Hrdina 2020-03-10 13:15:52 UTC
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.


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