Bug 1164966 - Guest could still start up while set vnc port=0 or 65536 with the qemu-kvm packet
Summary: Guest could still start up while set vnc port=0 or 65536 with the qemu-kvm pa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-18 02:53 UTC by zhenfeng wang
Modified: 2015-11-19 05:56 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.16-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:56:03 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description zhenfeng wang 2014-11-18 02:53:05 UTC
Description of problem:
Guest could still start up while set vnc port=0 or 65536 with the qemu-kvm packet.
BTW, it could get the expect result with the qemu-kvm-rhev packet
Version-Release number of selected component (if applicable):
libvirt-1.2.8-6.el7.x86_64
qemu-kvm-1.5.3-79.el7.x86_64
kernel-3.10.0-203.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Set vnc port=0 in guest's xml
#virsh dumpxml rhel7
--
<graphics type='vnc' port='0' autoport='no'/>

2.start the guest, the guest could start successfully with vnc port=0
# virsh start rhel7
Domain rhel7 started

#virsh dumpxml rhel7
--
    <graphics type='vnc' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

3.Set the vnc port=65536, then start the guest, the guest could start
successfully with vnc port=65536

#virsh dumpxml rhel7
--
<graphics type='vnc' port='65536' autoport='no'/>

# virsh start rhel7
Domain rhel7 started

<graphics type='vnc' port='65536' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>


4.Install the qemu-kvm-rhev packet in the host

5.set the vnc port=65536 in guest'xml then start the guest
the guest will fail to start and get the expect error
# virsh start virt-tests-vm1
error: Failed to start domain virt-tests-vm1
error: internal error: process exited while connecting to monitor: 2014-11-13T12:35:11.561842Z qemu-kvm: Failed to start VNC server on `127.0.0.1:59636': port 59636 out of range

6.set the vnc port=0 in guest'xml , then start the guest
the guest will fail to start and get the expect error
# virsh start virt-tests-vm1
error: Failed to start domain virt-tests-vm1
error: internal error: process exited while connecting to monitor: 2014-11-13T12:35:34.145725Z qemu-kvm: Failed to start VNC server on `127.0.0.1:-5900': can't convert to a number: -5900

7.The spice could get the expect result with both qemu-kvm and qemu-kvm-rhev packet

Actual results:
]Guest could still start up while set vnc port=0 or 65536 with the qemu-kvm packet

Expected results:
should fail to start the guest and get the expect error

Comment 2 Jiri Denemark 2014-11-18 09:40:36 UTC
There are two bugs here. One of them is in libvirt, which shouldn't even try to start QEMU with incorrect port numbers and another one is in qemu-kvm.

Comment 4 Pavel Hrdina 2015-05-13 08:31:35 UTC
Upstream commit:

commit afaffeb873c69912ba6443e5638abd057f00f1cc
Author: Pavel Hrdina <phrdina@redhat.com>
Date:   Tue May 12 18:18:14 2015 +0200

    qemu: vnc: error out for invalid port number
    
    In the XML we have the vnc port number, but QEMU takes on command line
    a vnc screen number, it's port-5900.  We should fail with error message
    that only ports in range [5900,65535] are valid.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1164966
    
    Signed-off-by: Pavel Hrdina <phrdina@redhat.com>

v1.2.15-71-gafaffeb

Comment 6 vivian zhang 2015-07-27 03:08:35 UTC
I can produce this with build 
libvirt-1.2.8-6.el7.x86_64
qemu-kvm-1.5.3-79.el7.x86_64


verify this bug with build 
libvirt-1.2.17-2.el7.x86_64
qemu-kvm-1.5.3-98.el7.x86_64

1. edit guest with XML vnc port='65536'
...
<graphics type='vnc' port='65536' autoport='no'/>
...
# virsh edit vm1
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

Failed. Try again? [y,n,i,f,?]: 
Domain vm1 XML configuration edited.

2. choose i to ignore this validate error and start guest with vpnc port='65536'

# virsh start vm1
error: Failed to start domain vm1
error: unsupported configuration: vnc port must be in range [5900,65535]


3. edit guest with XML vnc port='0'
# virsh edit vm1
...
<graphics type='vnc' port='0' autoport='no'/>
...


# virsh start vm1
error: Failed to start domain vm1
error: unsupported configuration: vnc port must be in range [5900,65535]

move to verified

Comment 8 errata-xmlrpc 2015-11-19 05:56:03 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/RHBA-2015-2202.html


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