Bug 524035 - libvirt should support USB device detach
Summary: libvirt should support USB device detach
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 12
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F13VirtTarget
TreeView+ depends on / blocked
 
Reported: 2009-09-17 16:34 UTC by Vladimir Benes
Modified: 2010-03-16 15:22 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-03-16 15:22:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vladimir Benes 2009-09-17 16:34:53 UTC
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):
libvirt-0.7.1-4.fc12.x86_64
virt-viewer-0.2.0-1.fc12.x86_64
libvirt-client-0.7.1-4.fc12.x86_64
virt-manager-0.8.0-3.fc12.noarch
virt-top-1.0.3-5.fc12.x86_64
python-virtinst-0.500.0-2.fc12.noarch
libvirt-python-0.7.1-4.fc12.x86_64
virt-mem-0.3.1-9.fc12.x86_64

gpxe-roms-qemu-0.9.7-5.fc12.noarch
qemu-kvm-0.10.92-4.fc12.x86_64
qemu-common-0.10.92-4.fc12.x86_64
qemu-system-x86-0.10.92-4.fc12.x86_64
qemu-kvm-tools-0.10.92-4.fc12.x86_64
qemu-img-0.10.92-4.fc12.x86_64

kernel-2.6.31-14.fc12.x86_64

How reproducible:


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
  
Actual results:

have to reboot

Expected results:
guest still running

Additional info:

Comment 1 Mark McLoughlin 2009-09-17 17:17:19 UTC
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

Comment 2 Daniel Berrangé 2009-09-21 11:02:01 UTC
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'

Comment 3 Mark McLoughlin 2009-09-21 14:53:41 UTC
(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
> device.

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'  

Yep

Comment 4 Bug Zapper 2009-11-16 12:34:15 UTC
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:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Cole Robinson 2010-03-16 15:22:42 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.