Bug 1081881 - Fail to start guest with 2 displays mixed with port allocated automatically and fixed port.
Summary: Fail to start guest with 2 displays mixed with port allocated automatically a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1081882
TreeView+ depends on / blocked
 
Reported: 2014-03-28 06:46 UTC by zhengqin
Modified: 2015-03-05 07:33 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1081882 (view as bug list)
Environment:
Last Closed: 2015-03-05 07:33:24 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description zhengqin 2014-03-28 06:46:25 UTC
Description of problem:
1. Add 2 displays for 1 guest, and for 1st display is port allocated
automatically and 2nd display is port fixed, the guest could not be started.
2. Add 2 displays for 1 guest, and for 1st display is port fixed and 2nd
display is port allocated automatically, the guest could not be started.




Version-Release number of selected component:
virt-manager-0.10.0-20.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Start virt-manager and shutoff all guests.

2. Open one guest's detail page and remove all displays (VNC or Spice).

3. Add first Spice Display with port automatically allocated by "Add
Hardware" -> "Graphics" -> "Spice Server" Type, and make sure Port
"Automatically allocated" is checked.

4. Add second VNC Display with fixed port "5900" by "Add Hardware" ->
"Graphics" -> "VNC Server" Type, and make sure Port "Automatically
allocated" is not checked and Port is 5900.

5. Start this guest.



Actual result:

-----------------------------------------------------------------------------------------------
Error starting domain: internal error: early end of file from monitor:
possible problem:
qemu-kvm: Failed to start VNC server on `127.0.0.1:0': Failed to bind
socket: Address already in use

Error starting domain: internal error: early end of file from monitor:
possible problem:
qemu-kvm: Failed to start VNC server on `127.0.0.1:0': Failed to bind
socket: Address already in use


Traceback (most recent call last):
   File "/usr/share/virt-manager/virtManager/asyncjob.py", line 100, in
cb_wrapper
     callback(asyncjob, *args, **kwargs)
   File "/usr/share/virt-manager/virtManager/asyncjob.py", line 122, in
tmpcb
     callback(*args, **kwargs)
   File "/usr/share/virt-manager/virtManager/domain.py", line 1220, in
startup
     self._backend.create()
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 698, in create
     if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: early end of file from monitor: possible
problem:
qemu-kvm: Failed to start VNC server on `127.0.0.1:0': Failed to bind
socket: Address already in use
-----------------------------------------------------------------------------------------------------



Expected results:
1. Guest could be started since one of display with port "Automatically
allocated"



Additional info:
1. This issue also occurs when first display is fixed port 5900 and
second display is port Automatically allocated.
2. This issue also occurs on RHEL6.

Comment 1 Giuseppe Scrivano 2014-06-23 18:17:18 UTC
it looks like a problem in libvirt, I've sent some patches upstream:

http://www.redhat.com/archives/libvir-list/2014-June/msg01084.html

Comment 2 Giuseppe Scrivano 2014-06-24 12:23:23 UTC
Fixed upstream with:

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

    graphics: remember graphics not auto allocated ports
    
    When looking for a port to allocate, the port allocator didn't take in
    consideration ports that are statically set by the user.  Defining
    these two graphics elements in the XML would cause an error, as the
    port allocator would try to use the same port for the spice graphics
    element:
    
        <graphics type='spice' autoport='yes'/>
        <graphics type='vnc' port='5900' autoport='no'/>
    
    The new *[pP]ortReserved variables keep track of the ports that were
    successfully tracked as used by the port allocator but that weren't
    bound.
    
    Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1081881
    
    Signed-off-by: Giuseppe Scrivano <gscrivan>

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

    virtportallocator: new function "virPortAllocatorSetUsed"
    
    virPortAllocatorSetUsed permits to set a port as already used and
    prevent the port allocator to use it without any attempt to bind it.
    
    Signed-off-by: Giuseppe Scrivano <gscrivan>
    Signed-off-by: Michal Privoznik <mprivozn>

Comment 5 Luyao Huang 2014-11-21 02:38:15 UTC
I can reproduce this issue with libvirt-1.1.1-29.el7.x86_64:

# virsh dumpxml etsd
    <graphics type='spice' port='5900' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

# virsh start etsd
error: Failed to start domain etsd
error: internal error: process exited while connecting to monitor: qemu-kvm: Failed to start VNC server on `127.0.0.1:0': Failed to bind socket: Address already in use

And use virt-manager can get the same result.

Verify with libvirt-1.2.8-7.el7.x86_64 :

# virsh dumpxml etsd
    <graphics type='spice' port='5900' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

# virsh start etsd
Domain etsd started

Comment 7 errata-xmlrpc 2015-03-05 07:33:24 UTC
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


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