Bug 989848

Summary: qemu should give friendly prompt when specify invalid vnc port value
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.5CC: acathrow, bsarathy, chayang, flang, juzhang, mazhang, mdeng, michen, mkenneth, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 23:36:29 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 Sibiao Luo 2013-07-30 04:24:30 UTC
Description of problem:
If specify invalid vnc port value in qemu-kvm command line, the qemu should quit with friendly prompt. Also tried the spice that has no such issue.

Version-Release number of selected component (if applicable):
host info:
2.6.32-402.el6.x86_64
qemu-kvm-0.12.1.2-2.381.el6.x86_64
seabios-0.6.1.2-28.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
...-vnc host:display
If you do not specify host, connections will be accepted from any host, The TCP port on which the VNC session is then running is normally a 5900 + display number.  

1.# /usr/libexec/qemu-kvm -vnc :aaaa -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info vnc
Server:
     address: 0.0.0.0:5900
        auth: none
Client: none
(qemu) q

2.# /usr/libexec/qemu-kvm -vnc :99999999999 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info vnc
Server:
     address: 0.0.0.0:65291
        auth: none
Client: none
(qemu) q

3.# /usr/libexec/qemu-kvm -vnc :-10 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info vnc
Server:
     address: 0.0.0.0:5890
        auth: none
Client: none
(qemu) q

4.# /usr/libexec/qemu-kvm -vnc :-999 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info vnc
Server:
     address: 0.0.0.0:4901
        auth: none
Client: none
(qemu) 
5.# /usr/libexec/qemu-kvm -vnc :-9999 -monitor stdio
Failed to start VNC server on `:-9999': address resolution failed for :-4099: Servname not supported for ai_socktype

Actual results:


Expected results:
Qemu should quit with a friendly prompt, like:
for step 1, qemu quit with prompt: Parameter 'port' expects a number
for step 2, qemu quit with prompt: -vnc port value is out of range
...

Additional info:
Also tried the spice, testing as following.
# /usr/libexec/qemu-kvm -spice port=999999999,disable-ticketing -monitor stdio
spice port is out of range

# /usr/libexec/qemu-kvm -spice port=aaaa,disable-ticketing -monitor stdio
qemu-kvm: -spice port=aaaa,disable-ticketing: Parameter 'port' expects a number
parse error: port=aaaa,disable-ticketing
 
# /usr/libexec/qemu-kvm -spice port=-9999,disable-ticketing -monitor stdio
spice port is out of range

# /usr/libexec/qemu-kvm -spice port=-1,disable-ticketing -monitor stdio
spice port is out of range

# /usr/libexec/qemu-kvm -spice port=0,disable-ticketing -monitor stdio
neither port nor tls-port specified for spice.

# /usr/libexec/qemu-kvm -spice port=1,disable-ticketing -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice
Server:
     migrated: false
     address: 0.0.0.0:1
        auth: none
Channels: none
(qemu) q

Comment 2 Ademar Reis 2013-08-01 23:36:29 UTC
corner case, not a customer issue, so WONTFIX for RHEL6 (there's already a bug for RHEL7: bug 733600).