oVirt USB Passthrough

Passing through USB devices to an oVirt VM is not that difficult, but I was unable to find any actual correct documentation on this when I was trying to do so a few months ago. So, here’s my attempt.

  1. Make sure that you have the USB hook installed. On Fedora, it’s as easy as:

    $ yum install vdsm-hook-hostusb

  2. Add the custom properties definition (run this from the machine that has the engine installed):

    $ engine-config -s "UserDefinedVMProperties=hostusb=^0x[0-9a-fA-F]{4}:0x[0-9a-fA-F]{4}$"

    You’ll need to select your oVirt version here.

    This will tell oVirt to show a field called hostusb that expects to see 0xHHHH:0xHHHH (where H is a hex digit).

  3. Restart ovirt-engine:

    $ service ovirt-engine restart

    At this point the USB hook has been setup, now we just need to set up the specific device with the specific VM.

  4. Determine the Vendor and Product ID for your device:

    $ lsusb

    Find your device in the lsusb output, and note down the ID. The first part will be the vendor ID, and the second will be the product ID. For example:

    Bus 002 Device 004: ID 1a2c:0c21 China Resource

    The vendor ID here is 1a2c and the product ID is 0c21.

  5. Shut down the VM and edit the VM (edit the VM, click Advanced, click Custom Properties)

  6. Add a custom key, select hostusb and enter the key. The format must be 0xHHHH:0xHHHH. For the example above the format would be: 0x1a2c:0x0c21.

  7. Save and start the VM. The USB device must be plugged into the server before starting the VM.