Bug 1713311
Summary: | redirected usb device cannot release from guest to client when quit virt-viewer with ctrl+c | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | zhoujunqin <juzhou> | |
Component: | virt-viewer | Assignee: | Francesco Giudici <fgiudici> | |
Status: | CLOSED ERRATA | QA Contact: | zhoujunqin <juzhou> | |
Severity: | medium | Docs Contact: | ||
Priority: | medium | |||
Version: | 7.7 | CC: | berrange, dblechte, fgiudici, fziglio, knoel, mxie, tzheng, victortoso, xiaodwan, zili | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | x86_64 | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | virt-viewer-5.0-18.el7 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1732653 (view as bug list) | Environment: | ||
Last Closed: | 2020-09-29 20:25:24 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: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1732653 |
Description
zhoujunqin
2019-05-23 11:34:29 UTC
Maybe would be helpful to use libusb_set_auto_detach_kernel_driver function? I didn't try but says that by default kernel driver will be automatically reattached when released. Note that the title of this bug is confusing. virt-viewer redirect client devices, not host ones. Probably you tested on the same machine (so the host is also the client) but title should be "redirected usb device cannot release from guest to client when quit virt-viewer with ctrl+c". Similar considerations for the description comment. (In reply to Frediano Ziglio from comment #4) > Note that the title of this bug is confusing. virt-viewer redirect client > devices, not host ones. Probably you tested on the same machine (so the host > is also the client) but title should be "redirected usb device cannot > release from guest to client when quit virt-viewer with ctrl+c". > Similar considerations for the description comment. Yes, i tested on the same machine. Thanks for your suggestion, i will update my bug title now. When a usb device is redirected by virt-viewer the auto loaded kernel driver gets detached from the device. Then virt-viewer (spice-gtk) claims the device so that the kernel will not interfere any more trying to configure the usb device. If virt-viewer is not terminated in a clean way (like with CRTL-C, which throws a SIGINT signal to the application) the kernel is never told to manage the device: the device will stay with no driver attached. The solution here is to add a SIGINT handler to virt-viewer to allow proper termination, giving back the control of the device to the kernel. Note that the issue is present on linux client only. Patch proposed here: https://www.redhat.com/archives/virt-tools-list/2019-December/msg00052.html Commit a724dff8a3ba6d5e8d3baf79b0041b1b73bd190d Author: Francesco Giudici <fgiudici> Date: Fri Jan 17 16:06:13 2020 +0100 remote-viewer: add handler for SIGINT signal Reproduce with package: virt-viewer-5.0-17.el7.x86_64 Try to verify with package: virt-viewer-5.0-18.el7.x86_64 Steps: 1. Have a usb device attached to your testing client: # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 14.5G 0 disk └─sda1 8:1 1 14.5G 0 part /run/media/juzhou/UNTITLED ---> attached usb device vda 252:0 0 25G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 24G 0 part ├─rhel-root 253:0 0 21.5G 0 lvm / └─rhel-swap 253:1 0 2.5G 0 lvm [SWAP] 2. Prepare a spice guest and start it. #virsh dumpxml $guest <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> <image compression='off'/> </graphics> ... <video> <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> 3. Use virt-viewer to connect to guest. # virt-viewer -c qemu:///system rhel7.8 4. In virt-viewer menu bar, select "File"->"USB device selection", check the usb device you want to plug into guest and click "close" button. check in guest: usb device is added(sda) # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 14.5G 0 disk └─sda1 8:1 1 14.5G 0 part /run/media/root/UNTITLED sr0 11:0 1 1024M 0 rom vda 252:0 0 7G 0 disk ... Check in client: by "lsblk": usb device "sda" is not showing # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 25G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 24G 0 part ├─rhel-root 253:0 0 21.5G 0 lvm / └─rhel-swap 253:1 0 2.5G 0 lvm [SWAP] 5. Use Ctrl+c to quit from virt-viewer command. # virt-viewer spice ^C Check in client: # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 14.5G 0 disk └─sda1 8:1 1 14.5G 0 part /run/media/juzhou/UNTITLED vda 252:0 0 25G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 24G 0 part ... Result: Redirected usb device is released from guest to client when quit virt-viewer with ctrl+c again. And It also works well when using 'remote-viewer spice://127.0.0.1:5900' command. So I move this bug from ON_QA to VERIFIED, thanks. 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 (virt-viewer bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:3993 |