Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora/Linux Management Tools (http://www.linux-archive.org/fedora-linux-management-tools/)
-   -   attach hot usb device (http://www.linux-archive.org/fedora-linux-management-tools/250498-attach-hot-usb-device.html)

"jmandawg" 02-22-2009 09:31 PM

attach hot usb device
 
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?


*


Thanks,


*


-J


*







_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

Cole Robinson 02-22-2009 10:08 PM

attach hot usb device
 
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

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

"jmandawg" 02-23-2009 12:47 AM

attach hot usb device
 
No go for me, maybe I'm running the wrong version of virsh?

virsh # attach-device XPJohn usbPhone2.xml
libvir: QEMU error : unknown device type
error: Failed to attach device from usbPhone2.xml

virsh # version
Compiled against library: libvir 0.4.0
Using library: libvir 0.4.0
Using API: QEMU 0.4.0
Running hypervisor: QEMU 0.9.1

[root@e6400:/etc/libvirt/ 482]$virsh list
Connecting to uri: qemu:///system
Id Name State
----------------------------------
1 XPJohn running
2 ubuntuVNC running
3 webserver running
4 XPTest running

[root@e6400:/etc/libvirt/ 481]$lsusb
Bus 007 Device 004: ID 0bb4:0b2e High Tech Computer Corp.
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

[root@e6400:/etc/libvirt/ 481]$cat usbPhone2.xml
<hostdev mode='subsystem' type='usb'>
<source>
<address bus='7' device='4'/>
</source>

What am I doing wrong?

-Jay

> -----Original Message-----
> From: Cole Robinson [mailto:crobinso@redhat.com]
> Sent: Sunday, February 22, 2009 6:09 PM
> To: Fedora/Linux Management Tools
> Cc: Libvirt; jmandawg@hotmail.com
> Subject: Re: [et-mgmt-tools] attach hot usb device
>
> 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


_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

Cole Robinson 02-23-2009 11:42 AM

attach hot usb device
 
jmandawg wrote:
> No go for me, maybe I'm running the wrong version of virsh?
>
> virsh # attach-device XPJohn usbPhone2.xml
> libvir: QEMU error : unknown device type
> error: Failed to attach device from usbPhone2.xml
>
> virsh # version
> Compiled against library: libvir 0.4.0
> Using library: libvir 0.4.0
> Using API: QEMU 0.4.0
> Running hypervisor: QEMU 0.9.1
>

You need libvirt version 0.5.0 or later.

Thanks,
Cole

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

"jmandawg" 02-23-2009 11:58 AM

attach hot usb device
 
Ok, Thanks.

I'm using Ubuntu so I guess I will have to compile it myself.

Thanks again,

-J

> -----Original Message-----
> From: Cole Robinson [mailto:crobinso@redhat.com]
> Sent: Monday, February 23, 2009 7:43 AM
> To: jmandawg
> Cc: 'Fedora/Linux Management Tools'; 'Libvirt'
> Subject: Re: [et-mgmt-tools] attach hot usb device
>
> jmandawg wrote:
> > No go for me, maybe I'm running the wrong version of virsh?
> >
> > virsh # attach-device XPJohn usbPhone2.xml
> > libvir: QEMU error : unknown device type
> > error: Failed to attach device from usbPhone2.xml
> >
> > virsh # version
> > Compiled against library: libvir 0.4.0
> > Using library: libvir 0.4.0
> > Using API: QEMU 0.4.0
> > Running hypervisor: QEMU 0.9.1
> >
>
> You need libvirt version 0.5.0 or later.
>
> Thanks,
> Cole

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools


All times are GMT. The time now is 09:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.