Bug 1732653

Summary: redirected usb device cannot release from guest to host when quit virt-viewer with ctrl+c
Product: Red Hat Enterprise Linux 8 Reporter: zhoujunqin <juzhou>
Component: virt-viewerAssignee: Francesco Giudici <fgiudici>
Status: CLOSED ERRATA QA Contact: zhoujunqin <juzhou>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: berrange, dblechte, elima, mxie, rh-spice-bugs, tzheng, victortoso, virt-bugs, xiaodwan, zili
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-viewer-9.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1713311 Environment:
Last Closed: 2020-11-04 03:53:18 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: 1713311, 1837489    
Bug Blocks:    

Comment 1 Victor Toso 2020-02-06 14:16:26 UTC
Fixed by 

Commit a724dff8a3ba6d5e8d3baf79b0041b1b73bd190d
Author: Francesco Giudici <fgiudici>
Date:   Fri Jan 17 16:06:13 2020 +0100

    remote-viewer: add handler for SIGINT signal

Comment 2 zhoujunqin 2020-06-03 06:01:04 UTC
Test with latest virt-viewer build:
virt-viewer-9.0-1.el8.x86_64

Step:
1. Have a usb device attached to your testing client:(eg: sdb)

# lsblk 

NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    0 238.5G  0 disk 
├─sda1          8:1    0     1G  0 part /boot
└─sda2          8:2    0 237.5G  0 part 
  ├─rhel-root 253:0    0    70G  0 lvm  /
  ├─rhel-swap 253:1    0   5.7G  0 lvm  [SWAP]
  └─rhel-home 253:2    0 161.9G  0 lvm  /home
sdb             8:16   1  28.9G  0 disk 
├─sdb1          8:17   1   8.3G  0 part /run/media/root/RHEL-8-3-0-BaseOS-x86_64
└─sdb2          8:18   1    10M  0 part 


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 $guest


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 28.9G  0 disk 
├─sda1          8:1    1  8.3G  0 part /run/media/root/RHEL-8-3-0-BaseOS-x86_64
└─sda2          8:2    1   10M  0 part 
vda           252:0    0    8G  0 disk 
...

Check in client: by "lsblk": usb device "sdb" is not showing
# lsblk 
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    0 238.5G  0 disk 
├─sda1          8:1    0     1G  0 part /boot
└─sda2          8:2    0 237.5G  0 part 
  ├─rhel-root 253:0    0    70G  0 lvm  /
  ├─rhel-swap 253:1    0   5.7G  0 lvm  [SWAP]
  └─rhel-home 253:2    0 161.9G  0 lvm  /home


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    0 238.5G  0 disk 
├─sda1          8:1    0     1G  0 part /boot
└─sda2          8:2    0 237.5G  0 part 
  ├─rhel-root 253:0    0    70G  0 lvm  /
  ├─rhel-swap 253:1    0   5.7G  0 lvm  [SWAP]
  └─rhel-home 253:2    0 161.9G  0 lvm  /home
sdb             8:16   1  28.9G  0 disk 
├─sdb1          8:17   1   8.3G  0 part /run/media/root/RHEL-8-3-0-BaseOS-x86_64
└─sdb2          8:18   1    10M  0 part 


Result: Redirected usb device(sdb) 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 the bug issue has been fixed, thanks.

Comment 6 zhoujunqin 2020-06-08 02:16:04 UTC
Move this bug from ON_QA to VERIFIED based on Comment 2, thanks.

Comment 9 errata-xmlrpc 2020-11-04 03:53:18 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 (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:4788