Score:0

How to auto redirect a usb device on virt-manager

in flag

How do I automatically redirect a USB device to a remote KVM? preferrably filtered by ID.

I have a KVM running on a server (QEMU+SSH), and the display protocol is Spice. How could I always redirect a USB device with a specific ID to the remote machine when the viewer is opened?

Iv'e been searching, but did not found a configuration that fits my use case. I've tried:

  • Adding a TCP redirection, but it prevents the machine from starting with a error and it's not clear to me how to specify a address filter.
<redirdev bus='usb' type='tcp'>
    <source mode='connect' host='localhost' service='4000'/>
</redirdev>
  • adding a host device, but this does not seem to work on a remote setup because the USB device is not attached to the server, but to my local machine.
<devices>
  <hostdev mode='subsystem' type='usb'>
    <source startupPolicy='optional'>
      <vendor id='0x1234'/>
      <product id='0xbeef'/>
    </source>
    <boot order='2'/>
  </hostdev>
</devices>
  • a section on spice's manual, but i'm not sure how to apply to my use-case

  • And a few other things where virt-manager would simply 'delete' or 'correct' the XML, probably indicating that it is not a supported option.

Also, manually redirecting the USB device works, but is not a viable solution for my use-case.

this: https://libvirt.org/formatdomain.html helped a bit.

the only guide I could find, was paywalled.

Score:0
tt flag

For what it is worth, that Red Hat Customer Portal link is paywalled by account only (accountwalled?) There's no payment required to view, you just need to create an account.

The article does not say a whole tonne. "Updates in RHEL 6.6 have enabled support for both automatic and manual SPICE USB redirection in virt-manager." plus a few supporting sentences and a link to the relevant advisory https://access.redhat.com/errata/RHBA-2014:1447.html.

As far as resolving your issue is concerned, if you are using the Virtual Machine Manager GUI then under Edit > Preferences > Console there is a an option to toggle Spice USB Redirection as manual or automatic. I was looking to disable it when I found your post. Unfortunately in your case, this is only an enable/disable toggle with no way to filter how it is applied (at least through this interface).

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.