Description of problem: Spice port 65536 is converted to 1 Version-Release number of selected component (if applicable): libvirt-4.4.0-2.virtcov.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Set spice port to 65536 in domain xml: <graphics type='spice' port='65536' autoport='no'/> 2.Start guest # virsh start rhel7.5 error: Failed to start domain rhel7.5 error: internal error: Failed to reserve port 0 Actual results: Guest fails to start, but the error message is not correct Expected results: # virsh start rhel7.5 error: Failed to start domain rhel7.5 error: internal error: qemu unexpectedly closed the monitor: 2018-06-15T08:15:33.094481Z qemu-kvm: spice port is out of range
Current git version of libvirt no longer shows the incorrect error message, fixed by: commit 5e828d03bf662331579c24677d29e50b9bc33951 Author: Pavel Hrdina <phrdina> AuthorDate: 2018-06-14 09:17:10 +0200 Commit: Pavel Hrdina <phrdina> CommitDate: 2018-06-14 09:52:21 +0200 virtportallocator: Change number of ports to 65536 USHRT_MAX is not good enough because the value is 65535 which specifies the number of bits in bitmap. The allowed port range is 0-65535 so we need to increase the number. We could have USHRT_MAX + 1 but let's define the number explicitly. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1590214 Reviewed-by: Ján Tomko <jtomko> Signed-off-by: Pavel Hrdina <phrdina> git describe: v4.4.0-247-g5e828d03bf contains: v4.5.0-rc1~115
Issue still exists: libvirt-4.5.0-6.el7.x86_64 qemu-kvm-rhev-2.12.0-9.el7.x86_64 Description: Spice port 65536 is converted to 0 unless after a fresh libvirtd restart Steps: 1.Define a guest with spice graphic port='65536': <graphics type='spice' port='65536' autoport='no'/> 2.Try to start the guest: # virsh start yan-V error: Failed to start domain yan-V error: internal error: Failed to reserve port 0 3.Restart libvirtd and try to start the guest again and again: # systemctl restart libvirtd # virsh start yan-V error: Failed to start domain yan-V error: internal error: qemu unexpectedly closed the monitor: 2018-08-09T11:10:33.509086Z qemu-kvm: spice port is out of range # virsh start yan-V error: Failed to start domain yan-V error: internal error: Failed to reserve port 0 # virsh start yan-V error: Failed to start domain yan-V error: internal error: Failed to reserve port 0 ... Actual results: Guest starts failed, always get error "Failed to reserve port 0", except restart a fresh libvirtd, the error "spice port is out of range" will show once. More details pls refer to "reproduce-logs" in attachment.
Created attachment 1474654 [details] reproduce-logs_comment5
Upstream patch: https://www.redhat.com/archives/libvir-list/2019-January/msg00715.html
commit c2a8256991d772323a3df08c33b012bf12d62645 Author: Ján Tomko <jtomko> CommitDate: 2019-01-25 14:50:05 +0100 virPortAllocatorSetUsed: ignore port 0 Similar to what commit 86dba8f3 did for virPortAllocatorRelease, ignore port 0 in virPortAllocatorSetUsed. For all the reasonable use cases the callers already check that the port is non-zero, however if the port from the XML overflows unsigned short and turns into 0, it can be set as used by virPortAllocatorSetUsed but not released by virPortAllocatorRelease. Also skip port '0' in virPortAllocatorSetUsed to make this behavior symmetric. The serenity was disturbed by commit 5dbda5e9 which started using virPortAllocatorRelease instead of virPortAllocatorSetUsed (false). https://bugzilla.redhat.com/show_bug.cgi?id=1591645 Signed-off-by: Ján Tomko <jtomko> Reviewed-by: Cole Robinson <crobinso> git describe: v5.0.0-109-gc2a8256991
Verify this bug with: libvirt-daemon-5.5.0-2.module+el8.1.0+3773+7dd501bf.x86_64 qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64 Steps: Scenario 1: spice port testing 1. <graphics type='spice' port='65536' autoport='no'> <listen type='address'/> </graphics> # virsh start avocado-vt-vm1 error: Failed to start domain avocado-vt-vm1 error: internal error: process exited while connecting to monitor: 2019-07-31T10:48:45.888568Z qemu-kvm: spice port is out of range # systemctl restart libvirtd # virsh start avocado-vt-vm1 error: Failed to start domain avocado-vt-vm1 error: internal error: process exited while connecting to monitor: 2019-07-31T10:49:04.275179Z qemu-kvm: spice port is out of range 2. <graphics type='spice' port='0' autoport='no'/> # virsh dumpxml avocado-vt-vm1 --inactive |grep graphic -1 <graphics type='spice'> <listen type='none'/> </graphics> # virsh start avocado-vt-vm1 Domain avocado-vt-vm1 started # virsh dumpxml avocado-vt-vm1 |grep graphic -1 <graphics type='spice'> <listen type='none'/> </graphics> 3. <graphics type='spice' port='65535' autoport='no'> <listen type='address'/> </graphics> # virsh start avocado-vt-vm1 Domain avocado-vt-vm1 started # virsh dumpxml avocado-vt-vm1 |grep graphic -1 </input> <graphics type='spice' port='65535' autoport='no' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> </graphics> 4. <graphics type='spice' port='-1' autoport='no'> <listen type='address'/> </graphics> # virsh start avocado-vt-vm1 Domain avocado-vt-vm1 started # virsh dumpxml avocado-vt-vm1 |grep graphic -1 <graphics type='spice' port='5900' autoport='no' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> </graphics> <video> 5. <graphics type='spice' port='5902' autoport='no'> <listen type='address'/> </graphics> # virsh start avocado-vt-vm1 Domain avocado-vt-vm1 started # virsh dumpxml avocado-vt-vm1 |grep graphic -1 <graphics type='spice' port='5902' autoport='no' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> </graphics> Scenario 2: spice tls-port testing 1. <graphics type='spice' port='5901' tlsPort='65536' autoport='no'> <listen type='address'/> </graphics> # vim /etc/libvirt/qemu.conf spice_tls = 1 # systemctl restart libvirtd # virsh start avocado-vt-vm1 error: Failed to start domain avocado-vt-vm1 error: internal error: process exited while connecting to monitor: 2019-07-31T11:10:51.170585Z qemu-kvm: spice tls-port is out of range 2. <graphics type='spice' port='5901' tlsPort='0' autoport='no'/> # virsh dumpxml avocado-vt-vm1 |grep graphic -1 <graphics type='spice' port='5901' autoport='no'> <listen type='address'/> </graphics> # virsh start avocado-vt-vm1 Domain avocado-vt-vm1 started # virsh dumpxml avocado-vt-vm1 |grep graphic -1 <graphics type='spice' port='5901' autoport='no' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> </graphics>
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/RHBA-2019:3723