[SOLVED] Can I attach multiple USB devices from one xml file to VM (with virsh)?

Issue

I have a two USB sticks (radios) I need to attach to a VM. I can do so by getting the vendor/product ID and creating an xml file (usb_device_1.xml) with:

<hostdev mode='subsystem' type='usb' managed='yes'>
  <source>
    <vendor id='0x0658''/>
    <product id='0x0200'/>
  </source>
</hostdev>

But can I add more in the same file? I would always want to add/remove them together. I tried wrapping with:

<devices>
  <hostdev mode='subsystem' type='usb' managed='yes'>
    <source>
      <vendor id='0x0658''/>
      <product id='0x0200'/>
    </source>
  </hostdev>
  <hostdev mode='subsystem' type='usb' managed='yes'>
    <source>
      <vendor id='0x1cf1'/>
      <product id='0x0030'/>
    </source>
  </hostdev>
</devices>

but with no luck, and I didn’t find any "multi-device" help in Red Hat’s documentation. Is there a way, or do I need to have separate xml files for each USB device?

Solution

It is not possible to define multiple USB devices in one XML file currently unfortunately. It is also NOT possible to pass through a USB hub currently to say work around this.

If the groupings on your motherboard work out though, it is possible to pass through one or more USB ports by passing through their controller. You can then attach a hub or any device to these ports and they get passed in.

This solved the issue for me.

Answered By – Zexelon

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.