On Mon, Feb 03, 2020 at 02:20:47PM +0100, Maxime Accadia wrote:
Hi,
We have a VM with several USB devices attached. Everything works well, but sometimes,
after a reboot of the host, some usb device get a different bus/device number and that
prevent the reboot of the VM :
-------
error: Failed to start domain xxx
error: internal error: Did not find USB device 04b9:0300 bus:1 device:5
-------
I guess this is because we have multiple usb devices with the same vendor/product ID :
-------
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x04b9'/>
<product id='0x0300'/>
<address bus='2' device='4'/>
</source>
<alias name='hostdev0'/>
<address type='usb' bus='0' port='2'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x0529'/>
<product id='0x0001'/>
<address bus='1' device='7'/>
</source>
<alias name='hostdev1'/>
<address type='usb' bus='0' port='1.2'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x0529'/>
<product id='0x0001'/>
<address bus='2' device='3'/>
</source>
<alias name='hostdev2'/>
<address type='usb' bus='0' port='1.4'/>
</hostdev>
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x04b9'/>
<product id='0x0300'/>
<address bus='1' device='6'/>
</source>
<alias name='hostdev3'/>
<address type='usb' bus='0' port='1.1'/>
</hostdev>
-------
Any idea on how to handle this case ?
We were thinking about using udev, but it seems that libvirt only supports vendor/id (not
unique in our case) and bus/device (not predictable) to identify usb devices.
There has been a proposal (or two?) for addressing USB hostdevs by bus/port
https://bugzilla.redhat.com/show_bug.cgi?id=1497984
Sadly it never landed upstream.
Other than writing a custom script that fills in the <address bus='1'
device='6'/> XML with the current values, I can't think of any solution.
Jano
Thanks,
Maxime Accadia
P.S. We use libvirt 4.0.0 on Ubuntu 18.04