[libvirt-users] Duplicate USB vendor,product specification

Daniel P. Berrange berrange at redhat.com
Mon Mar 15 19:16:45 UTC 2010


On Mon, Mar 15, 2010 at 01:25:47PM -0500, Don Morrison wrote:
> 
> I studying how to attach USB devices to a KVM guest virtual machine using
> libvirt. Using the "vendor" and "product" to specify the source device
> seems like a good option since the "bus" and "device" values can change as
> a device is removed and re-inserted. The question I have is what should I
> expect to happen if I plug in two identical USB devices - so they have the
> same vendor/product information? There is nothing in the documentation on
> libvirt.org to address this case. Thanks.

I can tell you that the behaviour will not be what you want :-)

The current logic just iterates over devices in sysfs until it finds one
with a matching vendor+product ID.

So it is pot-luck which device you'll hit. And if you try to configure
two guests with same vendor+product ID, they'll likely both get the same 
device even if you plug in two different ones with same vendor+product.

We need todo somewhat better in this regard. For PCI devices we track
what devices are assigned to guests so we can guarentee uniqueness of
assignment. We need todo the same with USB devices. At which point it
becomes easy to ensure that if you have 2 identical devices both will
be given to separate guests.

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvirt-users mailing list