Red Hat Bugzilla – Bug 524035
libvirt should support USB device detach
Last modified: 2010-03-16 11:22:42 EDT
Description of problem:
when I plug in USB flash and attach it I cannot detach it in virt-manager any more
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.plug in USB device
2.via virt-manager add usb device as a storage
3.try to detach it via virt-manager
have to reboot
guest still running
Yeah, seems like libvirt doesn't support USB detach for some reason
I assume the error message is:
only SCSI or virtio disk device can be detached dynamically
Looks like this is perfectly possible to implement, adding to F13VirtTarget
The reason its not implemented is that QEMU's usb_del monitor command is more or less useless
First consider what you do to attach a USB device, eg either on command line use '-usb mouse' or via monitor use 'usb_add mouse'
The monitor 'usb_del' command though requires the USB bus+device address of the device to be attached. The trouble is that this address is not assigned at time of usb attachment - its assigned only when the guest OS activates the USB device.
eg, consider this example
$ ./i386-softmmu/qemu -usb -usbdevice mouse -usbdevice tablet -monitor stdio
QEMU 0.11.50 monitor - type 'help' for more information
(qemu) info usb
Device 0.0, Speed 12 Mb/s, Product QEMU USB Mouse
Device 0.0, Speed 12 Mb/s, Product QEMU USB Hub
Device 0.0, Speed 12 Mb/s, Product QEMU USB Tablet
You can do 'usb_del 0.0' but which device is it going to detach - its anybody's guess :-( Even if addresses were present, its impossible to distinguish two devices of the same type in 'info usb'.
So to do this we need qdev 'id' flag support I think. libvirt could assign a unique identifier 'usbmouse0', and then be allowed todo 'usb_del usbmouse0'
(In reply to comment #2)
> The trouble is that this address is not assigned at
> time of usb attachment - its assigned only when the guest OS activates the USB
Ah, okay - interesting.
> So to do this we need qdev 'id' flag support I think. libvirt could assign a
> unique identifier 'usbmouse0', and then be allowed todo 'usb_del usbmouse0'
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.
More information and reason for this action is here:
Pretty sure this is fixed in latest libvirt. Since this is part of -device support which is hugely invasive, it will only be in rawhide/F14 unless we rebase older Fedora. Closing as RAWHIDE.