All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] external usb flash drive support on qemu virtualization
@ 2016-09-26 15:25 Kumar Girish
  2016-09-28  8:26 ` Stefan Hajnoczi
  0 siblings, 1 reply; 7+ messages in thread
From: Kumar Girish @ 2016-09-26 15:25 UTC (permalink / raw)
  To: qemu-devel

Dear All,

I am new to virtualization on Linux. Any help and support is appreciated.

Explanation of my current setup
Procesor : intel atom
linux kernel : 3.10
Virtualization at kernel : KVM
Virtualization at application : QEMU 2.7.0

Problem
When flash drive(pen drive ) is inserted and mounted, it is mounted and visible at host. But same is not visible at guest VM.

Regards,
Girish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-09-26 15:25 [Qemu-devel] external usb flash drive support on qemu virtualization Kumar Girish
@ 2016-09-28  8:26 ` Stefan Hajnoczi
  2016-10-20 15:07   ` Kumar Girish
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28  8:26 UTC (permalink / raw)
  To: Kumar Girish; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

On Mon, Sep 26, 2016 at 03:25:26PM +0000, Kumar Girish wrote:
> I am new to virtualization on Linux. Any help and support is appreciated.
> 
> Explanation of my current setup
> Procesor : intel atom
> linux kernel : 3.10
> Virtualization at kernel : KVM
> Virtualization at application : QEMU 2.7.0
> 
> Problem
> When flash drive(pen drive ) is inserted and mounted, it is mounted and visible at host. But same is not visible at guest VM.

The guest hardware is independent of the host hardware.  Devices plugged
into the host do not automatically appear inside the guest.

How to make the flash drive available to the guest depends on how you
are using QEMU.

Are you using a management tool like virt-manager or virsh?
virt-manager has a graphical user interface for passing USB devices into
the guest.  Go to Details | Add Hardware | USB Host Device.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-09-28  8:26 ` Stefan Hajnoczi
@ 2016-10-20 15:07   ` Kumar Girish
  2016-10-20 15:52     ` Stefan Hajnoczi
  0 siblings, 1 reply; 7+ messages in thread
From: Kumar Girish @ 2016-10-20 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

Hi All,

I have analysed my code and added the usb configuration while spawning the guest CMM. Unfortunately still the usb is not visible.
Could you please help me on this. 
I added this config   "-usb -usbdevice host:090c:1000 " . you can see in the last but one line  
Following is my config

/bin/qemu-system-x86_64 -aos cmm -smp 2 -m 3072 -aosimage /flash/working/Mos.img -device virtio-prestera --enable-kvm -machine accel=kvm -qmp tcp:127.0.0.1:11364,server,nowait -netdev type=tap,id=eth0,ifname=tun0cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth0,mac=2c:fa:a2:0a:29:46  -netdev type=tap,id=eth1,ifname=tun1cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth1,mac=00:0a:1e:11:11:f8  -netdev type=tap,id=eth2,ifname=tun2cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth2  -netdev type=tap,id=eth3,ifname=tun3cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth3,mac=00:0a:1e:11:11:f8 -netdev type=tap,id=eth4,ifname=tun4cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth4 -nographic -pidfile /CMMGuestPid -append -usb -usbdevice host:090c:1000  "console=ttyS0 empipaddr=172.17.2.189 empnetmask=255.255.255.0 empgateway=172.17.2.254 medora_early.ALU_VMSlotNum=0 medora_early.ALU_VMPrimaryA=1 medora_early.ALU_VMIsCmm=1"

Have few questions please clarify.

1. Is it possible to add usb configuration once the guest is UP. That is dynamically adding the usb configuration 
2. Once the configuration is done,  should I unplug and plug the usb flash stick (pendrive) 
3. does lsusb show usb devices at guest also 

Regards,
Girish

-----Original Message-----
From: Stefan Hajnoczi [mailto:stefanha@gmail.com] 
Sent: Wednesday, September 28, 2016 1:56 PM
To: Kumar Girish
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] external usb flash drive support on qemu virtualization

On Mon, Sep 26, 2016 at 03:25:26PM +0000, Kumar Girish wrote:
> I am new to virtualization on Linux. Any help and support is appreciated.
> 
> Explanation of my current setup
> Procesor : intel atom
> linux kernel : 3.10
> Virtualization at kernel : KVM
> Virtualization at application : QEMU 2.7.0
> 
> Problem
> When flash drive(pen drive ) is inserted and mounted, it is mounted and visible at host. But same is not visible at guest VM.

The guest hardware is independent of the host hardware.  Devices plugged into the host do not automatically appear inside the guest.

How to make the flash drive available to the guest depends on how you are using QEMU.

Are you using a management tool like virt-manager or virsh?
virt-manager has a graphical user interface for passing USB devices into the guest.  Go to Details | Add Hardware | USB Host Device.

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-10-20 15:07   ` Kumar Girish
@ 2016-10-20 15:52     ` Stefan Hajnoczi
  2016-10-21  5:47       ` Kumar Girish
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-10-20 15:52 UTC (permalink / raw)
  To: Kumar Girish; +Cc: qemu-devel

On Thu, Oct 20, 2016 at 4:07 PM, Kumar Girish
<girish.kumar@al-enterprise.com> wrote:
> I have analysed my code and added the usb configuration while spawning the guest CMM. Unfortunately still the usb is not visible.
> Could you please help me on this.
> I added this config   "-usb -usbdevice host:090c:1000 " . you can see in the last but one line
> Following is my config
>
> /bin/qemu-system-x86_64 -aos cmm -smp 2 -m 3072 -aosimage /flash/working/Mos.img -device virtio-prestera --enable-kvm -machine accel=kvm -qmp tcp:127.0.0.1:11364,server,nowait -netdev type=tap,id=eth0,ifname=tun0cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth0,mac=2c:fa:a2:0a:29:46  -netdev type=tap,id=eth1,ifname=tun1cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth1,mac=00:0a:1e:11:11:f8  -netdev type=tap,id=eth2,ifname=tun2cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth2  -netdev type=tap,id=eth3,ifname=tun3cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth3,mac=00:0a:1e:11:11:f8 -netdev type=tap,id=eth4,ifname=tun4cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth4 -nographic -pidfile /CMMGuestPid -append -usb -usbdevice host:090c:1000  "console=ttyS0 empipaddr=172.17.2.189 empnetmask=255.255.255.0 empgateway=172.17.2.254 medora_early.ALU_VMSlotNum=0 medora_early.ALU_VMPrimaryA=1 medora_early.ALU_VMIsCmm=1"
>
> Have few questions please clarify.
>
> 1. Is it possible to add usb configuration once the guest is UP. That is dynamically adding the usb configuration

Yes.  The usb_add/usb_del monitor commands or device_add/device_del
can be used.  I don't know the exact syntax, sorry.

> 2. Once the configuration is done,  should I unplug and plug the usb flash stick (pendrive)

I believe the physical USB device must be plugged into the host before
you tell QEMU to add the device.

> 3. does lsusb show usb devices at guest also

Yes.

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-10-20 15:52     ` Stefan Hajnoczi
@ 2016-10-21  5:47       ` Kumar Girish
  2016-10-21  8:09         ` Stefan Hajnoczi
  2016-10-21  9:25         ` Markus Armbruster
  0 siblings, 2 replies; 7+ messages in thread
From: Kumar Girish @ 2016-10-21  5:47 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Thank you for info. May I know how to goto qemu monitor from command line.

Regard,
Girish

-----Original Message-----
From: Stefan Hajnoczi [mailto:stefanha@gmail.com] 
Sent: Thursday, October 20, 2016 9:22 PM
To: Kumar Girish
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] external usb flash drive support on qemu virtualization

On Thu, Oct 20, 2016 at 4:07 PM, Kumar Girish <girish.kumar@al-enterprise.com> wrote:
> I have analysed my code and added the usb configuration while spawning the guest CMM. Unfortunately still the usb is not visible.
> Could you please help me on this.
> I added this config   "-usb -usbdevice host:090c:1000 " . you can see in the last but one line
> Following is my config
>
> /bin/qemu-system-x86_64 -aos cmm -smp 2 -m 3072 -aosimage /flash/working/Mos.img -device virtio-prestera --enable-kvm -machine accel=kvm -qmp tcp:127.0.0.1:11364,server,nowait -netdev type=tap,id=eth0,ifname=tun0cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth0,mac=2c:fa:a2:0a:29:46  -netdev type=tap,id=eth1,ifname=tun1cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth1,mac=00:0a:1e:11:11:f8  -netdev type=tap,id=eth2,ifname=tun2cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth2  -netdev type=tap,id=eth3,ifname=tun3cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth3,mac=00:0a:1e:11:11:f8 -netdev type=tap,id=eth4,ifname=tun4cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth4 -nographic -pidfile /CMMGuestPid -append -usb -usbdevice host:090c:1000  "console=ttyS0 empipaddr=172.17.2.189 empnetmask=255.255.255.0 empgateway=172.17.2.254 medora_early.ALU_VMSlotNum=0 medora_early.ALU_VMPrimaryA=1 medora_early.ALU_VMIsCmm=1"
>
> Have few questions please clarify.
>
> 1. Is it possible to add usb configuration once the guest is UP. That 
> is dynamically adding the usb configuration

Yes.  The usb_add/usb_del monitor commands or device_add/device_del can be used.  I don't know the exact syntax, sorry.

> 2. Once the configuration is done,  should I unplug and plug the usb 
> flash stick (pendrive)

I believe the physical USB device must be plugged into the host before you tell QEMU to add the device.

> 3. does lsusb show usb devices at guest also

Yes.

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-10-21  5:47       ` Kumar Girish
@ 2016-10-21  8:09         ` Stefan Hajnoczi
  2016-10-21  9:25         ` Markus Armbruster
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-10-21  8:09 UTC (permalink / raw)
  To: Kumar Girish; +Cc: qemu-devel

On Fri, Oct 21, 2016 at 6:47 AM, Kumar Girish
<girish.kumar@al-enterprise.com> wrote:
> Thank you for info. May I know how to goto qemu monitor from command line.

The command-line you posted says:
-qmp tcp:127.0.0.1:11364,server,nowait

Since you have this option I guess you already have some way of
sending commands to the QMP monitor that is listening on port 11364.

QMP commands are documented in the qapi-schema.json file:
##
# @device_add:
#
# @driver: the name of the new device's driver
#
# @bus: #optional the device's parent bus (device tree path)
#
# @id: the device's ID, must be unique
#
# Additional arguments depend on the type.
#
# Add a device.
#
# Notes:
# 1. For detailed information about this command, please refer to the
#    'docs/qdev-device-use.txt' file.
#
# 2. It's possible to list device properties by running QEMU with the
#    "-device DEVICE,help" command-line argument, where DEVICE is the
#    device's name
#
# Example:
#
# -> { "execute": "device_add",
#      "arguments": { "driver": "e1000", "id": "net1",
#                     "bus": "pci.0",
#                     "mac": "52:54:00:12:34:56" } }
# <- { "return": {} }
#
# TODO This command effectively bypasses QAPI completely due to its
# "additional arguments" business.  It shouldn't have been added to
# the schema in this form.  It should be qapified properly, or
# replaced by a properly qapified command.
#
# Since: 0.13
##
{ 'command': 'device_add',
  'data': {'driver': 'str', 'id': 'str'},
  'gen': false } # so we can get the additional arguments

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] external usb flash drive support on qemu virtualization
  2016-10-21  5:47       ` Kumar Girish
  2016-10-21  8:09         ` Stefan Hajnoczi
@ 2016-10-21  9:25         ` Markus Armbruster
  1 sibling, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2016-10-21  9:25 UTC (permalink / raw)
  To: Kumar Girish; +Cc: Stefan Hajnoczi, qemu-devel

Kumar Girish <girish.kumar@al-enterprise.com> writes:

> Thank you for info. May I know how to goto qemu monitor from command line.

Please don't top-post.

usb_add/usb_del are legacy; best stick to device_add/device_del.  Try
something like

    (qemu) device_add usb-host,id=my-stick,hostbus=BUS,hostaddr=ADDR,vendorid=VID,productid=PRID

hostbus, hostaddr, vendorid and productid are optional, and match
anything when omitted.

The command line version of device_add is -device.  

To unplug, try

    (qemu) device_del my-stick

> Regard,
> Girish
>
> -----Original Message-----
> From: Stefan Hajnoczi [mailto:stefanha@gmail.com] 
> Sent: Thursday, October 20, 2016 9:22 PM
> To: Kumar Girish
> Cc: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] external usb flash drive support on qemu virtualization
>
> On Thu, Oct 20, 2016 at 4:07 PM, Kumar Girish <girish.kumar@al-enterprise.com> wrote:
>> I have analysed my code and added the usb configuration while spawning the guest CMM. Unfortunately still the usb is not visible.
>> Could you please help me on this.
>> I added this config   "-usb -usbdevice host:090c:1000 " . you can see in the last but one line
>> Following is my config
>>
>> /bin/qemu-system-x86_64 -aos cmm -smp 2 -m 3072 -aosimage /flash/working/Mos.img -device virtio-prestera --enable-kvm -machine accel=kvm -qmp tcp:127.0.0.1:11364,server,nowait -netdev type=tap,id=eth0,ifname=tun0cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth0,mac=2c:fa:a2:0a:29:46  -netdev type=tap,id=eth1,ifname=tun1cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth1,mac=00:0a:1e:11:11:f8  -netdev type=tap,id=eth2,ifname=tun2cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth2  -netdev type=tap,id=eth3,ifname=tun3cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth3,mac=00:0a:1e:11:11:f8 -netdev type=tap,id=eth4,ifname=tun4cmm,script=no,downscript=no  -device virtio-net-pci,netdev=eth4 -nographic -pidfile /CMMGuestPid -append -usb -usbdevice host:090c:1000  "console=ttyS0 empipaddr=172.17.2.189 empnetmask=255.255.255.0 empgateway=172.17.2.254 medora_early.ALU_VMSlotNum=0 medora_early.ALU_VMPrimaryA=1 medora_early.ALU_VMIsC!
 mm=1"
>>
>> Have few questions please clarify.
>>
>> 1. Is it possible to add usb configuration once the guest is UP. That 
>> is dynamically adding the usb configuration
>
> Yes.  The usb_add/usb_del monitor commands or device_add/device_del can be used.  I don't know the exact syntax, sorry.
>
>> 2. Once the configuration is done,  should I unplug and plug the usb 
>> flash stick (pendrive)
>
> I believe the physical USB device must be plugged into the host before you tell QEMU to add the device.
>
>> 3. does lsusb show usb devices at guest also
>
> Yes.
>
> Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-21  9:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 15:25 [Qemu-devel] external usb flash drive support on qemu virtualization Kumar Girish
2016-09-28  8:26 ` Stefan Hajnoczi
2016-10-20 15:07   ` Kumar Girish
2016-10-20 15:52     ` Stefan Hajnoczi
2016-10-21  5:47       ` Kumar Girish
2016-10-21  8:09         ` Stefan Hajnoczi
2016-10-21  9:25         ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.