[fedora-virt] USB passthrough and disconnect

Cole Robinson crobinso at redhat.com
Thu Oct 15 14:19:26 UTC 2009


On 10/15/2009 09:36 AM, Gianluca Cecchi wrote:
> Hello,
> following the instructions at
> http://www.redhat.com/archives/fedora-virt/2009-June/msg00182.html
> 
> I'm able to attach an USB key to my Windows XP SP3 guest.
> More better, I'm able to attach and use it with the guest already started.
> Very good!
> (Actually I don't have SElinux enabled so I skipped what related to it )
> 
> The doubt is, when in Windows I then safely remove the key and get the ok
> msg from the os, if I try to hot remove the USB device in details windows of
> the guest I receive the message that will be effective after reboot.
> Is this expected and the hot unplug a feature next to come, or do I miss
> anything in correct way to do things?
> 

USB hotunplug isn't supported by libvirt at the moment. I believe this
is because it has historically been difficult to get the proper
information from qemu that is required for hotunplug.

> My sw versions for host are F11 x86_64 with up2date rawvirt repo:
> libvirt-0.7.1-11.fc11.x86_64
> qemu-kvm-0.11.0-6.fc11.x86_64
> virt-manager-0.8.0-7.fc11.noarch
> 
> Suppose the message is correct behaviour based on current state of things,
> what would be correct approach if during a vm session I use several usb keys
> for example?
> 1) insert first usb key in host
> 2) add hw of first usb key in details tab of guest
> 3) use it in guest and at the end disconnect it from inside guest OS
> 4) remove hw in details tab of guest; confirming that this will overwrite
> any othe rchanges occured in guest config....
> 5) remove key form host usb plug
> 6) insert second usb key in host
> 7) add hw of second usb key in details tab of guest
> 8) use it in guest and at the end disconnect it from inside guest OS
> 9) ? If I do same as 4 do I loose the action made in 4) ??
> 

Yes, you will likely lose the effect of step 4. When the VM shuts down,
USB1 will still appear to be attached.

This is a side effect of how virt-manager interacts with libvirt to
update a running VMs config when hotplug/unplug is not available (as in
the USB hotunplug case, or say trying to hotplug an IDE disk).

We actually should be able to fix in this in virt-manager now, and can
remove the  'This will overwrite any other changes' text. I'll get to it
for the next virt-manager release.

- Cole




More information about the Fedora-virt mailing list