Bug 1590214

Summary: "Failed to reserve port 65535" for guest graphic
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Yanqiu Zhang <yanqzhan>
Severity: low Docs Contact:
Priority: low    
Version: 7.6CC: lmen, xuzhang, yanqzhan
Target Milestone: rcKeywords: Automation, Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.5.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 09:56:58 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 Fangge Jin 2018-06-12 08:37:16 UTC
Description of problem:
Set graphic port to 65535, guest will fail to start.

# virsh dumpxml $guest
    <graphics type='vnc' port='65534' autoport='no' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

# virsh start $guest
error: Failed to start domain 1
error: internal error: Failed to reserve port 65535

I think if set bitmap->nbits = 65536, or change "bitmap->nbits <= b" to "bitmap->nbits < b", the problem will be gone.

int
virBitmapSetBit(virBitmapPtr bitmap,
                size_t b)
{
    if (bitmap->nbits <= b)
        return -1;

    bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] |= VIR_BITMAP_BIT(b);
    return 0;
}



Version-Release number of selected component (if applicable):
libvirt-4.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
65534 can work

Comment 3 Pavel Hrdina 2018-06-14 07:32:26 UTC
Upstream patch posted:

https://www.redhat.com/archives/libvir-list/2018-June/msg01089.html

Comment 4 Pavel Hrdina 2018-06-14 07:58:55 UTC
Upstream commit:

commit 5e828d03bf662331579c24677d29e50b9bc33951
Author: Pavel Hrdina <phrdina>
Date:   Thu Jun 14 09:17:10 2018 +0200

    virtportallocator: Change number of ports to 65536

Comment 6 Yanqiu Zhang 2018-08-09 10:46:14 UTC
Verify with:
libvirt-4.5.0-6.el7.x86_64
qemu-kvm-rhev-2.12.0-9.el7.x86_64

Steps to verify:
1. start guest with vnc graphic port='65535':
# virsh start yan-V
Domain yan-V started

# virsh dumpxml yan-V|grep 'graphics t' -A2
    <graphics type='vnc' port='65535' autoport='no' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

# ps aux|grep qemu|grep vnc
 -vnc 0.0.0.0:59635 

2.define a guest with graphic port='65536', try to start it:
# virsh start yan-V 
error: Failed to start domain yan-V
error: unsupported configuration: vnc port must be in range [5900,65535]

3.retest step2 with port='65537':
same as step 2

Since the test result is as expected. mark this bug as verified.

Comment 8 errata-xmlrpc 2018-10-30 09:56:58 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://access.redhat.com/errata/RHSA-2018:3113