Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 769144

Summary: The parameter "to=<port>" of vnc works bad
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: acathrow, areis, bcao, bsarathy, juzhang, kraxel, mazhang, michen, mkenneth, rhod, sluo, virt-bugs, virt-maint
Target Milestone: rc   
Target Release: 7.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-12 08:19:31 UTC Type: ---
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 2011-12-20 03:51:32 UTC
Description of problem:
The command line parameter value of "to=<port>" should specify the display range and the qemu will try to find a free one, The parameter "to=<port>" of vnc works bad when all the ports were in used.

Version-Release number of selected component (if applicable):
Server info:
2.6.32-220.el6.x86_64
qemu-kvm-0.12.1.2-2.210.el6.x86_64
tigervnc-1.0.90-0.17.20110314svn4359.el6.x86_64

Client info:
vnc-reflector-1.2.4-7.fc12.x86_64

How reproducible:
100%

Steps to Reproduce:
1. specified the display range in host A.
eg. ...-vnc :1,to=2 
2. take all the display number in used in host A.
eg. # /usr/libexec/qemu-kvm -vnc :1
    # /usr/libexec/qemu-kvm -vnc :2
3. start a guest  with the CLI of the step 1.
4. 'info vnc' in monitor shows the display actually used.
(qemu) info vnc
Server:
     address: 0.0.0.0:5903
        auth: none

Actual results:
the port number 5903 can be used.

Expected results:
the available port should be 5901,5902. for 5903 port, can not be used.

Additional info:

Comment 2 Gerd Hoffmann 2012-01-04 12:05:53 UTC
Simple off-by-one bug, qemu stops checking at 5903 instead of 5902.

Comment 3 Ademar Reis 2012-03-22 17:49:00 UTC
Simple bug, but low impact, apparently not even triggered by libvirt standard usage. Moving to 6.4.

Comment 8 Gerd Hoffmann 2013-12-11 16:48:04 UTC
Please retest with latest qemu-kvm.

Comment 9 juzhang 2013-12-12 02:22:53 UTC
Hi Sluo,

Could you have a try then update the result in the bz?

Best Regards,
Junyi

Comment 10 Sibiao Luo 2013-12-12 02:46:40 UTC
(In reply to Gerd Hoffmann from comment #8)
> Please retest with latest qemu-kvm.
The rhel7.0 latest qemu-kvm did not hit this issue any more.
# /usr/libexec/qemu-kvm -vnc :1 &
# /usr/libexec/qemu-kvm -vnc :2 &
# /usr/libexec/qemu-kvm -vnc :1,to=2 -monitor stdio
QEMU 1.5.3 monitor - type 'help' for more information
(qemu) qemu-kvm: Failed to start VNC server on `:1,to=2': Failed to bind socket: Address already in use

host info:
# uname -r && rpm -q qemu-kvm-rhev && rpm -q seabios
3.10.0-60.el7.x86_64
qemu-kvm-rhev-1.5.3-21.el7.x86_64
seabios-1.7.2.2-4.el7.x86_64

Also tried the rhel6.5 host also not hit it any more.
# /usr/libexec/qemu-kvm -vnc :2 &
[1] 18092
# /usr/libexec/qemu-kvm -vnc :3 &
[2] 18098
# /usr/libexec/qemu-kvm -vnc :2,to=3 -monitor stdio
qemu-kvm: Failed to start VNC server on `:2,to=3': socket bind failed: Address already in use
host info:
# uname -r && rpm -q qemu-kvm-rhev
2.6.32-425.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.415.el6.x86_64

Best Regards,
sluo

Comment 11 Gerd Hoffmann 2013-12-12 08:19:31 UTC
Good.  chardev hotplug backport also brought in some socket code patches, they probably fixed this one as side effect in rhel6.