[libvirt] Re: [et-mgmt-tools] attach hot usb device

Cole Robinson crobinso at redhat.com
Sun Feb 22 23:08:45 UTC 2009


cc-ing libvir-list (future libvirt questions should be directed there)

jmandawg wrote:
> Hi,
> 
>  
> 
> Quick question, since I can’t get to the qemu monitor anymore, how do I
> hot add a usb device (smartphone)?
> 
> Is it possible to do through virsh?
> 

Sure:

- Use 'lsusb' to determine the bus and device. Example listing looks like:

Bus 001 Device 006: ID 0781:5151 SanDisk Corp. Cruzer Micro 256/512MB
Flash Drive

- Put hostdev xml in a file:

cat << __EOF__ > usb.xml
    <hostdev mode='subsystem' type='usb'>
      <source>
        <address bus='1' device='6'/>
      </source>
    </hostdev>
__EOF__

- Run 'virsh attach-device {VMNAME} usb.xml' on a running VM.

Hope that helps,
Cole




More information about the libvir-list mailing list