Hide Forgot
Description of problem: USB slots out of range are accepted by libvirt Version-Release number of selected component (if applicable): libvirt-daemon-2.0.0-10.el7.x86_64 How reproducible: 100 % Steps to Reproduce: 1. Define a domain referencing a non-existent USB port: $ virsh define /dev/stdin <<EOF <domain type='kvm'> <name>port_out_of_range</name> <memory unit='MiB'>512</memory> <vcpu>1</vcpu> <os> <type machine='pc'>hvm</type> </os> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <controller type='usb' index='0' model='piix3-uhci'/> <input type='tablet' bus='usb'> <address type='usb' bus='0' port='7'/> </input> </devices> </domain> EOF Actual results: Domain port_out_of_range defined from /dev/stdin Expected results: An error is reported. Additional info: Starting this domain fails: $ virsh start port_out_of_range error: Failed to start domain port_out_of_range error: internal error: process exited while connecting to monitor: 2016-11-28T16:23:27.731597Z qemu-kvm: -device usb-tablet,id=input0,bus=usb.0,port=7: usb port 7 (bus usb.0) not found (in use?)
Upstream patch: https://www.redhat.com/archives/libvir-list/2016-November/msg01395.html
Pushed upstream: commit 2650d5e1f5f8712cc8bf83ddf1bd2abcfb312259 Author: Ján Tomko <jtomko> CommitDate: 2016-11-30 10:59:01 +0100 qemu: error out on USB ports out of range My overly sophisticated address reservation code forgot to add an error message for user-requested ports out of range. https://bugzilla.redhat.com/show_bug.cgi?id=1399260 git describe: v2.5.0-rc1-9-g2650d5e
Version : libvirt-3.2.0-3.el7.x86_64 qemu-kvm-rhev-2.9.0-2.el7.x86_64 Steps : Test with different USB controllers: piix3-uhci, companion controllers; nec-xhci. 1. Define a domain edit vm and add an USB device with port out of range. # virsh edit r74 error: XML error: requested USB port 10 not present on USB bus 0 Failed. Try again? [y,n,i,f,?]: 2. Define and start a guest. # virsh list Id Name State ---------------------------------------------------- 1 r74 running Attach an usb device with port out of range. # cat udisk.xml <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/raw.img'/> <backingStore/> <target dev='sde' bus='usb'/> <address type='usb' bus='0' port='10'/> </disk> # virsh attach-device r74 udisk.xml error: Failed to attach device from udisk.xml error: XML error: requested USB port 10 not present on USB bus 0 # virsh attach-device r74 udisk.xml --config error: Failed to attach device from udisk.xml error: XML error: requested USB port 10 not present on USB bus 0 As above, move this bug to verified.
Sorry for pasting the wrong version. Verified with version : libvirt-3.2.0-4.el7.x86_64 qemu-kvm-rhev-2.9.0-3.el7.x86_64
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/RHEA-2017:1846