Bug 807277

Summary: Enable auto-redir in virt-manager
Product: Red Hat Enterprise Linux 6 Reporter: Grant Williamson <grant_williamson>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: adevolder, cfergeau, crobinso, cwei, dblechte, gscrivan, hdegoede, jwu, lcui, malittle, marcandre.lureau, mjenner, mkletzan, mzhan, ngalvin, rbalakri, rmcswain, tlavigne, trichard, tzheng, walicki, zpeng
Target Milestone: rcFlags: rmcswain: needinfo?
Target Release: 6.4   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virt-manager-0.9.0-20.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 853317 923567 987763 (view as bug list) Environment:
Last Closed: 2014-10-14 06:25:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 964215, 996459, 1001999, 1031775, 1085318    
Bug Blocks: 1083163, 782183, 835616, 840699, 853317, 923567, 987763    
Attachments:
Description Flags
spice debug info with virt-manager
none
xml file of guest none

Description Grant Williamson 2012-03-27 12:19:40 UTC
Description of problem:
usb auto-redir is planned for inclusion in RHEL 6.3 however there are no plans to enable it in virt-manager.

Using remote-viewer and/or spicy on a host in conjunction with virt-manager confuses most end users.

The user experience with auto-redir should be seamlessly integrated on the rhel6 host.

I understand from the developer that adding support is somewhat trivial since all the code already exists in spice-gtk which virt-manager uses.

It should just be the case of enabling in virt-manager and adding a button for device selection.

Can this be reviewed for inclusion.

Comment 3 Cole Robinson 2012-04-02 21:59:26 UTC
Since this isn't upstream yet, it's a bit late for 6.3 cycle. Deferring to 6.4

Comment 4 Grant Williamson 2012-04-03 05:13:03 UTC
If a patch were to be created, we would be happy to re-spin out own package till 6.4 is released.

Comment 5 Dave Allan 2012-04-05 03:31:38 UTC
This RFE is certainly reasonable, so I think the best approach is to engage upstream and submit a patch there.  Cole or others can provide review and acks to move the process along.

Comment 14 Dave Allan 2012-10-02 18:28:07 UTC
(In reply to comment #5)
> This RFE is certainly reasonable, so I think the best approach is to engage
> upstream and submit a patch there.  Cole or others can provide review and
> acks to move the process along.

Nathan/Grant, is IBM planning on submitting any code upstream?

Comment 19 Gunannan Ren 2013-07-02 04:45:58 UTC
commit 88f2d1abe0ffecdf606acbf5f473034d858dc6db
Author: Guannan Ren <gren>
Date:   Mon Jul 1 14:33:59 2013 -0400

    details: Add auto USB redirection support in console viewer
    
    Add "Redirect USB device" option in console viewer. Initialize and
    embed UsbDeviceWidget object from SpiceClientGtk into a dialog to
    let user choose available USB devices for redirection.
    Throw an error message if USB connection failed.
    Auto-redirection is enable by default.
    
    There is race between creating usbredir channel and calling
    has_usb_redirection() when initializing spice session like
    happening on virt-viwer. So adding a new signal handler
    on_details_menu_virtual_manager_activate() to recheck the
    status of usbredir channel, set "Redirect USB device" option
    sensitive if it is availiable.

commit d6fc079ae88da2433ae257b25e58f48403b78cf7
Author: Guannan Ren <gren>
Date:   Mon Jul 1 14:33:06 2013 -0400

    error: use helper function to embed customized widget into dialog

Comment 31 Gunannan Ren 2013-09-04 18:43:58 UTC
backport patches sent out
http://post-office.corp.redhat.com/archives/rhvirt-patches/2013-September/msg00086.html

Comment 38 Giuseppe Scrivano 2014-02-04 13:27:16 UTC
*** Bug 964215 has been marked as a duplicate of this bug. ***

Comment 45 tingting zheng 2014-05-05 09:27:59 UTC
Tested with:
python-virtinst-0.600.0-20.el6.noarch
virt-manager-0.9.0-20.el6.x86_64

Steps:
1. Plug a usb on the host,launch virt-manager,open a guest,Click "Add Hardware"->"USB Redirection"->Type "Spice channel".
2. Open guest console,click "Virtualization"->"Redirect USB device",choose the usb,error shows:
USB redirection error
<GError at 0x26f74c0>
3.Use lsusb in guest,the usb is not redirected.

Refer to the above comments,move the bug to ASSIGNED.

Comment 46 Giuseppe Scrivano 2014-05-05 11:19:34 UTC
I've just tested it again here and it works correctly for me.  The error comes from spice-gtk-python.  What version of spice-gtk-python are you using?  What USB device?  Could you try with another USB device?

Comment 47 tingting zheng 2014-05-06 05:12:48 UTC
(In reply to Giuseppe Scrivano from comment #46)
> I've just tested it again here and it works correctly for me.  The error
> comes from spice-gtk-python.  What version of spice-gtk-python are you
> using?  What USB device?  Could you try with another USB device?

# rpm -qa |grep spice-gtk-python
spice-gtk-python-0.20-11.el6_5.1.x86_64

# lsusb
Bus 002 Device 003: ID 0951:1646 Kingston Technology

I tried another usb disk,the same error shows.

Comment 49 tingting zheng 2014-05-12 03:16:45 UTC
Created attachment 894539 [details]
spice debug info with virt-manager

Comment 51 Giuseppe Scrivano 2014-05-12 06:47:31 UTC
thanks for the log.  The error seems to come from spice and virt-manager has no control over it:

(virt-manager:11356): GSpice-DEBUG: usb-device-manager.c:1291 connecting device 0x371c9a0
(virt-manager:11356): GSpice-DEBUG: channel-usbredir.c:324 usbredir-9:0: connecting usb channel 0x37c8400
(virt-manager:11356): GSpice-DEBUG: channel-usbredir.c:490 usbredir-9:0: usbredirhost: device rejected
(virt-manager:11356): GSpice-DEBUG: channel-usbredir.c:683 usbredir-9:0: Kingston DataTraveler 3.0 [0951:1666] at 2-2 rejected by host
(virt-manager:11356): GSpice-DEBUG: channel-usbredir.c:397 usbredir-9:0: disconnecting device from usb channel 0x37c8400
(virt-manager:11356): GSpice-DEBUG: channel-usbredir.c:490 usbredir-9:0: usbredirhost: device disconnected
2014-05-11 23:14:19,149 (error:83): dialog message: USB redirection error : USB redirection error

Should I reassign or clone this bug to spice-gtk?

Comment 52 Giuseppe Scrivano 2014-05-13 12:38:40 UTC
moving to spice-gtk for further probing...

Comment 54 Christophe Fergeau 2014-05-19 09:14:33 UTC
If you connect to the same VM using virt-viewer/remote-viewer, is USB redirection working?

Comment 55 tingting zheng 2014-05-20 02:50:22 UTC
(In reply to Christophe Fergeau from comment #54)
> If you connect to the same VM using virt-viewer/remote-viewer, is USB
> redirection working?

# lsusb
Bus 002 Device 007: ID 0951:1666 Kingston Technology 

When I use virt-viewer to connect the same guest,click "File"->"USB device selection",click the usb disk I want to redirect,there is error:'USB redirection error:Kingston DataTraveler 3.0 [0951:1666] at 2-7 rejected by host.

Comment 56 Giuseppe Scrivano 2014-05-21 11:56:24 UTC
could you please attach the XML definition for your VM (virsh dumpxml guest)?

Comment 57 tingting zheng 2014-05-22 02:32:46 UTC
Created attachment 898177 [details]
xml file of guest

Comment 58 Christophe Fergeau 2014-05-22 08:48:12 UTC
This XML seems to be missing the needed USB controllers for USB redirection to work, see http://people.freedesktop.org/~teuf/spice-doc/html/ch02s06.html#idm244178574320 . You will also be limited to redirecting one USB device at the same time.

Comment 59 tingting zheng 2014-05-22 11:06:59 UTC
(In reply to Christophe Fergeau from comment #58)
> This XML seems to be missing the needed USB controllers for USB redirection
> to work, see
> http://people.freedesktop.org/~teuf/spice-doc/html/ch02s06.
> html#idm244178574320 . You will also be limited to redirecting one USB
> device at the same time.

Yes,my fault,I should add usb controller with model usb2.

As virt-manager on rhel6 doesn't support to change for usb2 model,I modify guest xml to add:
 <controller type='usb' index='0' model='ich9-ehci1'/>
<controller type='usb' index='0' model='ich9-uhci1'>
  <master startport='0'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
  <master startport='2'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
  <master startport='4'/>
</controller>

Then follow step in comment 45.
1.Plug a usb on the host,launch virt-manager,open a guest,Click "Add Hardware"->"USB Redirection"->Type "Spice channel".
2.Open guest console,click "Virtualization"->"Redirect USB device",choose the usb,the usb disk can be redirected successfully.
3.For "USB Redirection" with type "tcp",there is bug 1085318 which is not fixed,so I will retest the bug with tcp type once the bug is fixed.

Comment 60 Giuseppe Scrivano 2014-05-22 11:46:08 UTC
can you test if the other cases work for you now?

Comment 61 tingting zheng 2014-05-23 06:00:28 UTC
(In reply to Giuseppe Scrivano from comment #60)
> can you test if the other cases work for you now?

Sure.
1.As virt-manager on rhel6 doesn't support to change for usb2 model,I filed a new RFE bug 1100561,since virt-manager GUI provide support USB Redirection,it's useful and convenient to support usb2 model from virt-manager.

2.I modify guest xml to add:
 <controller type='usb' index='0' model='ich9-ehci1'/>
<controller type='usb' index='0' model='ich9-uhci1'>
  <master startport='0'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
  <master startport='2'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
  <master startport='4'/>
</controller>

Tested for usb redirection with spice type,both virt-manager and virt-viewer/remote-viewer works well,usb disk can be redirected successfully.

Besides usb redirection with tcp type blocked by bug 1085318,If there is something I've missed,pls correct me.

Comment 63 Giuseppe Scrivano 2014-06-03 17:03:33 UTC
as the spice tcp redirection bug is already tracked and it is a known issue, I think we can skip to test it here.

Comment 64 tingting zheng 2014-06-04 02:42:21 UTC
(In reply to Giuseppe Scrivano from comment #63)
> as the spice tcp redirection bug is already tracked and it is a known issue,
> I think we can skip to test it here.

So from virt-manager GUI,I can open a guest,Click "Add Hardware"->"USB Redirection"->Type "Spice channel" or "tcp",usb redirection with spice type works well refer to comment 61,from virt-manager side,the bug has been fixed,so I moved the bug to VERIFIED.

Comment 67 errata-xmlrpc 2014-10-14 06:25:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1447.html