Bug 1487674

Summary: automatic port selection for VNC/Spice displays does not work
Product: [Fedora] Fedora Reporter: Evgeni Golov <egolov>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: agedosier, berrange, clalancette, crobinso, itamar, jforbes, laine, libvirt-maint, phrdina, veillard
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-01 15:23:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Evgeni Golov 2017-09-01 14:55:24 UTC
Description of problem:

When libvirt VMs are configured to use "Auto" as the port for VNC or Spice displays, they fail to start with "Address already in use". Assigning a static port works around this issue.

When creating a new VM (with Spice), the error displayed is:
Unable to complete install: 'internal error: process exited while connecting to monitor: 2017-09-01T14:21:59.705568Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/10 (label charserial0)

(process:25695): Spice-WARNING **: reds.c:2577:reds_init_socket: listen: Address already in use
2017-09-01T14:21:59.708505Z qemu-system-x86_64: failed to initialize spice server'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 2545, in _do_async_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 497, in start_install
    doboot, transient)
  File "/usr/share/virt-manager/virtinst/guest.py", line 433, in _create_guest
    domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3567, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirtError: internal error: process exited while connecting to monitor: 2017-09-01T14:21:59.705568Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/10 (label charserial0)

(process:25695): Spice-WARNING **: reds.c:2577:reds_init_socket: listen: Address already in use
2017-09-01T14:21:59.708505Z qemu-system-x86_64: failed to initialize spice server

When using vagrant-libvirt (which defaults to VNC), the error that is displayed is:
Call to virDomainCreateWithFlags failed: internal error: qemu unexpectedly closed the monitor: 2017-09-01T14:46:13.604480Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/10 (label charserial0)
2017-09-01T14:46:13.649172Z qemu-system-x86_64: -vnc 127.0.0.1:0: Failed to start VNC server: Failed to listen on socket: Address already in use

Version-Release number of selected component (if applicable):
libvirt-daemon-3.2.1-5.fc26.x86_64
qemu-system-x86-2.9.0-5.fc26.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start a VM that has a VNC or Spice display attached with port:auto

Actual results:
"Address already in use", VM does not start

Expected results:
VM starts

Additional info:
Not sure if it's libvirt or QEMU fault here.

Comment 1 Pavel Hrdina 2017-09-01 15:23:20 UTC

*** This bug has been marked as a duplicate of bug 1432684 ***