Bug 1461633

Summary: add extra hubs when cold/hot-plugging more USB devices
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Pei Zhang <pzhang>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DEFERRED QA Contact: lijuan men <lmen>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: dyuan, jiyan, jtomko, lmen, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-18 13:25:12 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:
Bug Depends On:    
Bug Blocks: 1473046    

Description Pei Zhang 2017-06-15 02:40:27 UTC
Description of problem:
libvirt should add extra hubs when cold/hot-pluging more USB devices 

Version-Release number of selected component (if applicable):
libvirt-3.2.0-10.el7.x86_64
qemu-kvm-rhev-2.9.0-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. Define a guest without USB disks.

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     vm1                            shut off

# virsh domblklist vm1
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/r74.qcow2

# virsh dumpxml vm1 | grep usb -A 3
......
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
--
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='1'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='2'/>
    </redirdev>

2. Cold plug multiple USB disks 
# for i in {a..h}; do virsh attach-disk vm1 /var/lib/libvirt/images/usb/usb$i.img --targetbus usb sd$i --config; done 
Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

error: Failed to attach disk
error: internal error: No free USB ports

error: Failed to attach disk
error: internal error: No free USB ports
......

3. Trying to hotplug multiple USB disks, also hit this issue. 

Actual results:
As step2, libvirt will not add extra hub when no free ports

Expected results:
Add enough hubs when cold/hot pluging more usb devices

Comment 2 Jaroslav Suchanek 2020-02-18 13:25:12 UTC
This bug was closed deferred as a result of bug triage.

Please reopen if you disagree and provide justification why this bug should
get enough priority. Most important would be information about impact on
customer or layered product. Please indicate requested target release.