Starting VM with several USB device (which can boot successfully when disabling USB support) failed when enabling USB support because identifying USB device plugged to hub failed
Description of problem:
Starting VM with several USB device failed after enabling USB suport because identifying USB device plugged to hub failed
Version-Release number of selected component (if applicable):
server:
rhvm-4.2.5.1-0.1.el7ev.noarch
host:
vdsm-4.20.39-1.el7ev.x86_64
kernel-3.10.0-942.el7.x86_64
libvirt-4.5.0-8.el7.x86_64
qemu-kvm-rhev-2.12.0-12.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1. New VM with several USB host device, disable USB support. start Vm successfully.
==> In this scenario, In XML, using 'piix3-uhci' USB controller which only supports 2 ports, so hub will be added, and several USB devices will be plugged to hub.
the dumpxml of VM is as following:
# virsh dumpxml jiyan-1
...
<controller type='usb' index='0' model='piix3-uhci'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
...
<controller type='ccid' index='0'>
<alias name='ccid0'/>
<address type='usb' bus='0' port='1'/>
</controller>
...
<hub type='usb'>
<alias name='hub0'/>
<address type='usb' bus='0' port='2'/>
</hub>
...
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<address bus='2' device='2'/>
</source>
<alias name='ua-3ad599b3-069d-4849-8391-43cf97b17240'/>
<address type='usb' bus='0' port='2.1'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<address bus='3' device='2'/>
</source>
<alias name='ua-6f48fe4c-fbb5-48c5-9ca5-852006b83510'/>
<address type='usb' bus='0' port='2.2'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<address bus='2' device='3'/>
</source>
<alias name='ua-801d94ed-661b-45f2-a324-9f968d1363c0'/>
<address type='usb' bus='0' port='2.3'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<address bus='3' device='4'/>
</source>
<alias name='ua-811d84bf-1a97-4fd8-b10d-ce14a98e52a6'/>
<address type='usb' bus='0' port='2.4'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<address bus='3' device='3'/>
</source>
<alias name='ua-a16494ac-2a31-4639-95db-11f6dc8186f7'/>
<address type='usb' bus='0' port='2.5'/>
</hostdev>
2. Shut down VM, then ensble 'USB support', VM will start failed with the following error
2018-09-05 01:46:37,028-04 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ForkJoinPool-1-worker-11) [] EVENT_ID: VM_DOWN_ERROR(119), VM jiyan-1 is down with error. Exit message: XML error: there is no hub at port 2 in USB address bus: 0 port: 2.1.
2018-09-05 01:46:37,045-04 ERROR [org.ovirt.engine.core.vdsbroker.monitoring.VmsMonitoring] (ForkJoinPool-1-worker-11) [] Rerun VM '488061ac-89e5-4139-b01c-bcc6bd9e4119'. Called from VDS 'host5'
2018-09-05 01:46:37,061-04 WARN [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engine-Thread-233944) [] EVENT_ID: USER_INITIATED_RUN_VM_FAILED(151), Failed to run VM jiyan-1 on Host host5.
Actual results:
As step-2 shows
Expected results:
The XML should be adjusted automatically and VM should start successfully.
Additional info:
In step-2, the XML is as following, Checking this XML in ovirt-engine.log:
43483 <controller type="usb" model="ich9-uhci1" index="0"/>
43527 <controller type="usb" model="ich9-ehci1" index="0"/>
43568 <controller type="usb" model="ich9-uhci2" index="0"/>
43569 <controller type="usb" model="ich9-uhci3" index="0"/>
...
43484 <hostdev managed="no" mode="subsystem" type="usb">
43485 <source>
43486 <address bus="2" device="2"/>
43487 </source>
43488 <alias name="ua-3ad599b3-069d-4849-8391-43cf97b17240"/>
43489 <address bus="0" port="2.1" type="usb"/>
43490 </hostdev>
Description of problem: Starting VM with several USB device failed after enabling USB suport because identifying USB device plugged to hub failed Version-Release number of selected component (if applicable): server: rhvm-4.2.5.1-0.1.el7ev.noarch host: vdsm-4.20.39-1.el7ev.x86_64 kernel-3.10.0-942.el7.x86_64 libvirt-4.5.0-8.el7.x86_64 qemu-kvm-rhev-2.12.0-12.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. New VM with several USB host device, disable USB support. start Vm successfully. ==> In this scenario, In XML, using 'piix3-uhci' USB controller which only supports 2 ports, so hub will be added, and several USB devices will be plugged to hub. the dumpxml of VM is as following: # virsh dumpxml jiyan-1 ... <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> ... <controller type='ccid' index='0'> <alias name='ccid0'/> <address type='usb' bus='0' port='1'/> </controller> ... <hub type='usb'> <alias name='hub0'/> <address type='usb' bus='0' port='2'/> </hub> ... <hostdev mode='subsystem' type='usb' managed='no'> <source> <address bus='2' device='2'/> </source> <alias name='ua-3ad599b3-069d-4849-8391-43cf97b17240'/> <address type='usb' bus='0' port='2.1'/> </hostdev> <hostdev mode='subsystem' type='usb' managed='no'> <source> <address bus='3' device='2'/> </source> <alias name='ua-6f48fe4c-fbb5-48c5-9ca5-852006b83510'/> <address type='usb' bus='0' port='2.2'/> </hostdev> <hostdev mode='subsystem' type='usb' managed='no'> <source> <address bus='2' device='3'/> </source> <alias name='ua-801d94ed-661b-45f2-a324-9f968d1363c0'/> <address type='usb' bus='0' port='2.3'/> </hostdev> <hostdev mode='subsystem' type='usb' managed='no'> <source> <address bus='3' device='4'/> </source> <alias name='ua-811d84bf-1a97-4fd8-b10d-ce14a98e52a6'/> <address type='usb' bus='0' port='2.4'/> </hostdev> <hostdev mode='subsystem' type='usb' managed='no'> <source> <address bus='3' device='3'/> </source> <alias name='ua-a16494ac-2a31-4639-95db-11f6dc8186f7'/> <address type='usb' bus='0' port='2.5'/> </hostdev> 2. Shut down VM, then ensble 'USB support', VM will start failed with the following error 2018-09-05 01:46:37,028-04 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ForkJoinPool-1-worker-11) [] EVENT_ID: VM_DOWN_ERROR(119), VM jiyan-1 is down with error. Exit message: XML error: there is no hub at port 2 in USB address bus: 0 port: 2.1. 2018-09-05 01:46:37,045-04 ERROR [org.ovirt.engine.core.vdsbroker.monitoring.VmsMonitoring] (ForkJoinPool-1-worker-11) [] Rerun VM '488061ac-89e5-4139-b01c-bcc6bd9e4119'. Called from VDS 'host5' 2018-09-05 01:46:37,061-04 WARN [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engine-Thread-233944) [] EVENT_ID: USER_INITIATED_RUN_VM_FAILED(151), Failed to run VM jiyan-1 on Host host5. Actual results: As step-2 shows Expected results: The XML should be adjusted automatically and VM should start successfully. Additional info: In step-2, the XML is as following, Checking this XML in ovirt-engine.log: 43483 <controller type="usb" model="ich9-uhci1" index="0"/> 43527 <controller type="usb" model="ich9-ehci1" index="0"/> 43568 <controller type="usb" model="ich9-uhci2" index="0"/> 43569 <controller type="usb" model="ich9-uhci3" index="0"/> ... 43484 <hostdev managed="no" mode="subsystem" type="usb"> 43485 <source> 43486 <address bus="2" device="2"/> 43487 </source> 43488 <alias name="ua-3ad599b3-069d-4849-8391-43cf97b17240"/> 43489 <address bus="0" port="2.1" type="usb"/> 43490 </hostdev>