[libvirt-users] Support for on-demand USB pass through

Hi, I'm trying to use USB pass through with devices that are not present at the VM startup. However, when starting the machine, libvirt complains that the USB device doesn't exist. I was following the guide at [1], but this doesn't seem to work on Debian Wheezy. Any hints how to achieve that? Thanks, Felicitus [1] http://david.wragg.org/blog/2009/03/usb-pass-through-with-libvirt-and-kvm.ht...

On Fri, Dec 07, 2012 at 11:25:49 +0100, Felicitus wrote:
Hi,
I'm trying to use USB pass through with devices that are not present at the VM startup. However, when starting the machine, libvirt complains that the USB device doesn't exist. I was following the guide at [1], but this doesn't seem to work on Debian Wheezy.
Any hints how to achieve that?
With libvirt-1.0.0 or newer, you can use startupPolicy='optional' for that USB device, as documented at http://www.libvirt.org/formatdomain.html#elementsUSB However, such device would not be automatically connected when it becomes available (which seems to be what you are after according to the guide you posted). You'd need to shut the VM down and start it up again. It might be possible to use USB redirection provided by SPICE (http://www.libvirt.org/formatdomain.html#elementsRedir) for this but I'm not sure about it, I've never used it. Jirka

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/12/2012 02:12 PM, Jiri Denemark wrote:
With libvirt-1.0.0 or newer, you can use startupPolicy='optional' for that USB device, as documented at http://www.libvirt.org/formatdomain.html#elementsUSB
However, such device would not be automatically connected when it becomes available (which seems to be what you are after according to the guide you posted). You'd need to shut the VM down and start it up again.
That sounds almost as what I need - however, a VM shutdown and startup again is not very handy. Is there any chance to attach the device at runtime to the VM? Our use case is this: We've got a VM which has CUPS installed, and any USB printers attached to the physical box need to be passed through to the VM. Printers are turned off when not in use, and thus they need to be attached in an automatic manner to the VM. Regards Felicitus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJQyIPyAAoJEJYpjrA42x19BvwH/06sScUuPXK0RPEQxbicRpsS RqYTUfNiu25HVCmFo9076ldLh10FB/RQYsNCqm+FebDOa1BJJwtOOFtwAxdcnPDk xQUxlaw20YKm+5soUdoCs9+S6xj8XCsS1utiTF6a79j/H6lo/yCdmb5ijaBtwNjj Ya8QkQd3GoP8b8YAF/ojsuktyzJySNZezymHA8TGZO4aLFhNmo3vF2/5HCiCYuhT 3PStlLoS4ZuU4zvwgr9MCT/OK89+C0P1OVvj4n2B699fUKZMFK5dOuvTkT24c9XS 0slQauK2MDcdBM8e8GiVtUpBxF0NJCi7eGxcej2gTWpk3tpBPmB/1PQvFNvTAGs= =S3kG -----END PGP SIGNATURE-----

On Wed, Dec 12, 2012 at 14:17:38 +0100, Felicitus wrote:
On 12/12/2012 02:12 PM, Jiri Denemark wrote:
However, such device would not be automatically connected when it becomes available (which seems to be what you are after according to the guide you posted). You'd need to shut the VM down and start it up again.
That sounds almost as what I need - however, a VM shutdown and startup again is not very handy.
Is there any chance to attach the device at runtime to the VM?
Yeah, with USB redirection, which I mentioned in the part of my email you did not quote :-) However, I'm not sure if it's possible to make it happen automatically or if you need to manually attach each device. Jirka

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Yeah, with USB redirection, which I mentioned in the part of my email you did not quote :-) However, I'm not sure if it's possible to make it happen automatically or if you need to manually attach each device.
I will try it out - but right now, I'm stuck with 0.9.x on Debian Wheezy. Now as you mention spice USB - are you sure that that's the only way? Because if I add a USB device in virt-manager, it appears immediately in the VM. Another idea would probably be to use USP/IP [1] which is already present as module on my Debian Wheezy installations. Regards, Felicitus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJQyJZrAAoJEJYpjrA42x199Q0H/3HFhZxYYF+n/O6X7O0SE+IU xhASHl8Feuu+Bp7AhQHipMFaXzDchyQ8F1Y3oPim+OkE+O216Cq4xkzf9Ky1L5+L T1TnLd4vELIpxqJL4n0YfusmNykjMhvc+Oo/uQIk4YcupU9jGzkHYljq52IYsyQi fUnYd0Y2IjnE5pfl7269IhGWUFY2RO9vi8eK43pD1WBwtmH0n2nUyzrNvTWoQOKj Ycq8EQTv2j5JAHpRTBj4EswGe2+D3nA5s8LEo/0MRzo1u7a5xRTiDTuUKETjY382 rIhWq+x5KnNGCeub4xXp14O31tDoKjZQEUgNBNq9cuEYpZqCtP2ZBPst3xNoxSE= =DUV7 -----END PGP SIGNATURE-----
participants (2)
-
Felicitus
-
Jiri Denemark