Bug 1326516 - qemu: static vnc websocket port can collide with auto allocated port number, breaks VM startup
Summary: qemu: static vnc websocket port can collide with auto allocated port number, ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard: LibvirtFirstBug
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-12 21:04 UTC by Cole Robinson
Modified: 2018-09-05 08:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-05 07:40:06 UTC
Embargoed:


Attachments (Terms of Use)

Description Cole Robinson 2016-04-12 21:04:19 UTC
Add this XML to a VM:

<graphics type='vnc' port='-1' autoport='yes' websocket='5900'/>

Then try to start it:

$ sudo virsh start ztester-vnc-f20
error: Failed to start domain ztester-vnc-f20
error: internal error: early end of file from monitor, possible problem: 2016-04-12T21:01:17.196237Z qemu-system-x86_64: -vnc 127.0.0.1:0,websocket=5900: Failed to start VNC server: Failed to bind socket: Address already in use

We don't track the static websocket port in the internal port lists, so it isn't checked for collision when allocating the regular VNC port. Regular VNC port is allocated 5900, and the VM fails to start. This commit fixed something similar, so to handle it for websockets we just need to follow this pattern:

commit 1a065caa79bb4e42178a9e431ddbe5550a1c0596
Author: Giuseppe Scrivano <gscrivan>
Date:   Tue Jun 24 13:34:18 2014 +0200

    graphics: remember graphics not auto allocated ports

Comment 1 Michal Privoznik 2018-09-05 07:40:06 UTC
I have tested this again and this is fixed now. Since the bug is 2.5 years old I don't think doing bisect to find the exact commit that fixed this bug is desired. Anyway, I'm closing this one.

Comment 2 Ján Tomko 2018-09-05 08:05:04 UTC
commit 1215965a4c4d635014ebb755f9c9181120aa17f2
Author:     Nikolay Shirokovskiy <nshirokovskiy>
AuthorDate: 2016-11-22 14:09:32 +0300
Commit:     John Ferlan <jferlan>
CommitDate: 2016-12-09 07:54:34 -0500

    qemu: mark user defined websocket as used
    
    We need extra state variable to distinguish between autogenerated
    and user defined cases after auto generation is done.

git describe: v2.5.0-61-g1215965a4c contains: v3.0.0-rc1~354


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