Bug 895373

Summary: fail to pass-through the physical USB stick redirected from usb-host to usb-guest using remote-viewer
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, chayang, flang, hdegoede, juzhang, mazhang, michen, qzhang, sluo, uril, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-15 10:43:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
USB redirection error.
none
There are no free USB channels. none

Description Sibiao Luo 2013-01-15 06:43:23 UTC
Description of problem:
Boot a guest with a physical USB stick redirected, and connect the guest with remote-viewer, then insert the physical USB device form usb-host after guest boot up. but it fail to pass-through the physical USB stick redirected from usb-host to usb-guest.
BTW, the rhel6.4 host can pass-through the physical USB stick redirected from usb-host to usb-guest using remote-viewer successfully.

Version-Release number of selected component (if applicable):
host info:
kernel-3.6.0-0.29.el7.x86_64
qemu-kvm-1.3.0-3.el7.x86_64
spice-server-0.12.0-1.el7.x86_64
spice-gtk-0.14-1.el7.x86_64
spice-gtk-tools-0.14-1.el7.x86_64
guest info:
kernel-3.6.0-0.29.el7.x86_64
clinet info:
kernel-3.6.0-0.29.el7.x86_64
virt-viewer-0.5.4-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot a guest with a physical USB stick redirected.
eg:...-device usb-ehci,id=ehci,bus=pci.0,addr=0x7 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,debug=2 -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864...
2.connect the guest with remote-viewer.
# remote-viewer spice://$client_ip:$port
3.insert the physical USB device form usb-host after guest boot up.
  
Actual results:
after step 3, it fail to redirect the physical USB stick from usb-host to usb-guest, and the 'USB device selection' button is grey and unusable in 'File-->USB device selection'.

Expected results:
it can pass-through the physical USB stick redirected from usb-host to usb-guest using remote-viewer, and it works well.

Additional info:

Comment 1 Sibiao Luo 2013-01-15 06:53:16 UTC
If pass-through the physical USB stick from local host directly, it's ok.
# lsusb | grep Kingston
Bus 002 Device 005: ID 0951:1642 Kingston Technology DT101 G2
e.g:...-device usb-ehci,id=ehci,bus=pci.0,addr=0x7 -device usb-host,hostbus=2,hostaddr=5,id=hostdev1,bus=ehci.0,port=1 -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864

Best Regards.
sluo

Comment 2 Hans de Goede 2013-01-15 09:01:53 UTC
(In reply to comment #0)
> Actual results:
> after step 3, it fail to redirect the physical USB stick from usb-host to
> usb-guest, and the 'USB device selection' button is grey and unusable in
> 'File-->USB device selection'.

If the USB device selection button is grey, then no usb channels are advertised
by the qemu process remote-viewer is connected to.

Please double check:
1) Your qemu commandline
2) That you're connecting to the right qemu process

If you still have this problem after checking both, please provide the full qemu commandline you are using, as well as full qemu output logs.

Comment 3 Sibiao Luo 2013-01-15 09:29:18 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > Actual results:
> > after step 3, it fail to redirect the physical USB stick from usb-host to
> > usb-guest, and the 'USB device selection' button is grey and unusable in
> > 'File-->USB device selection'.
> 
> If the USB device selection button is grey, then no usb channels are
> advertised
> by the qemu process remote-viewer is connected to.
> 
> Please double check:
> 1) Your qemu commandline
I have checked my qemu-kvm command line, but did not find any abnormalities.
> 2) That you're connecting to the right qemu process
connect to the VM correctly, I just boot one qemu-kvm process.
> If you still have this problem after checking both, please provide the full
> qemu commandline you are using, as well as full qemu output logs.
the full qemu output logs not so much, could you need me to specify the spice debug messages (e.g: export SPICE_DEBUG_LEVEL=5) to collect more logs ?

# /usr/libexec/qemu-kvm -M pc-1.2 -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name virtual-blk-device -uuid 350e716b-5f98-4bf0-9a2a-c8e423295244 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/RHEL6.4-20121212.1-Server-x86_64-copy.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -device scsi-hd,drive=drive-system-disk,bus=scsi0.0,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=2c:41:38:b6:40:22,bus=pci.0,addr=0x5,bootindex=2,event_idx=off -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -device usb-ehci,id=ehci,bus=pci.0,addr=0x7 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,debug=2 -drive file=/home/usb-storage.raw,if=none,id=storage,media=disk,cache=none,format=raw -device usb-storage,drive=storage,id=usb-storage -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -drive file=/home/floppy1.vfd,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -drive file=/home/my-cdrom1.iso,if=none,media=cdrom,format=raw,id=drive-ide1-0-1 -device ide-drive,drive=drive-ide1-0-1,id=ide1-0-1,bus=ide.0,unit=0
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
(/usr/libexec/qemu-kvm:4462): Spice-Warning **: reds.c:3865:spice_server_add_interface: unsupported char device interface
QEMU 1.3.0 monitor - type 'help' for more information
(qemu) main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 0.236000 ms, bitrate 5446808510 bps (5194.481382 Mbps)
inputs_connect: inputs channel client create
red_dispatcher_set_cursor_peer: 

Best Regards.
sluo

Comment 4 Hans de Goede 2013-01-15 09:44:16 UTC
(In reply to comment #3)

<snip>

> the full qemu output logs not so much

It is enough:

> reds.c:3865:spice_server_add_interface: unsupported char device interface

This is the likely culprit, I see you are still using spice-server-0.12.0. The latest spice-server for RHEL-7 is 0.12.2 which includes a lot of bugfixes, you can download it here:
https://brewweb.devel.redhat.com/buildinfo?buildID=248715

Please try again with spice-server-0.12.2

Thanks,

Hans

Comment 5 Sibiao Luo 2013-01-15 10:21:41 UTC
(In reply to comment #4)
> (In reply to comment #3)
> 
> <snip>
> 
> > the full qemu output logs not so much
> 
> It is enough:
> 
> > reds.c:3865:spice_server_add_interface: unsupported char device interface
> 
> This is the likely culprit, I see you are still using spice-server-0.12.0.
> The latest spice-server for RHEL-7 is 0.12.2 which includes a lot of
> bugfixes, you can download it here:
> https://brewweb.devel.redhat.com/buildinfo?buildID=248715
> 
> Please try again with spice-server-0.12.2
ok, thx for your kindly reminds. I have tried the spice-server-0.12.2-1.el7.x86_64, but still fail to work correctly.
prompt a error dialog box 'USB redirection error: usbredir protocol parse error for USB Device at 0-0'in guest when i insert the USB-stick in client after the guest boot up, then i hit'OK' to close it.
Select the USB-stick from (optional) 'File-->USB device selection' in remote-viewer, it will display 'There are no free USB channels', and i find there is no any USB-stick in guest.

full qemu output log:
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
QEMU 1.3.0 monitor - type 'help' for more information
(qemu) main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 0.226000 ms, bitrate 6400000000 bps (6103.515625 Mbps)
red_dispatcher_set_cursor_peer: 
inputs_connect: inputs channel client create

So, it still fail.

# rpm -qa | grep spice-server
spice-server-devel-0.12.2-1.el7.x86_64
spice-server-0.12.2-1.el7.x86_64

Comment 6 Sibiao Luo 2013-01-15 10:22:40 UTC
Created attachment 678703 [details]
USB redirection error.

Comment 7 Sibiao Luo 2013-01-15 10:23:05 UTC
Created attachment 678704 [details]
There are no free USB channels.

Comment 8 Hans de Goede 2013-01-15 10:43:56 UTC
(In reply to comment #6)
> Created attachment 678703 [details]
> USB redirection error.

I've never seen that error trigger before. This is seems to be caused by one of the qemu chadev flowcontrol patches having been mangled on rebase, since this is a different issue then originally reported I've filed a new bug to track this: bug 895491.

*** This bug has been marked as a duplicate of bug 895491 ***