Bug 1780508 - passthrough input device disappeared in the namespace when trying to attach the device to the guest twice
Summary: passthrough input device disappeared in the namespace when trying to attach t...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.0
Assignee: khanicov
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-06 08:50 UTC by yafu
Modified: 2021-11-16 07:50 UTC (History)
7 users (show)

Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 07:49:56 UTC
Type: Bug
Target Upstream Version: 7.6.0
Embargoed:


Attachments (Terms of Use)

Description yafu 2019-12-06 08:50:26 UTC
Description of problem:
passthrough input device disappeared in the namespace when trying to attach the device to the guest twice

Version-Release number of selected component (if applicable):
libvirt-5.10.0-1.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare the passthrough input device xml:
#cat input.xml
<input type='passthrough' bus='virtio'>
    <source evdev='/dev/input/event1'/>
</input>

2.Attach the input device to a guest:
# virsh attach-device vm2 input.xml 
Device attached successfully

3.Check the input device in the qemu namespace:
# nsenter -t `pidof qemu-kvm` -m ls -l /dev/input
total 0
crw-rw----. 1 qemu qemu 13, 65 Dec  6 03:20 event1

4.Attach the input device to the same guest again:
#virsh attach-device vm2 input.xml
error: Failed to attach device from dev.xml
error: internal error: unable to execute QEMU command 'device_add': /dev/input/event1: failed to get exclusive access: Device or resource bus

5.Check the input device in the qemu namespace:
# nsenter -t `pidof qemu-kvm` -m ls -l /dev/input
total 0

Actual results:
passthrough input device disappeared in the namespace when trying to attach the device to the guest twice

Expected results:
passthrough input device should not disappeare in the namespace when trying to attach the device to the guest twice

Additional info:

Comment 3 khanicov 2021-07-07 10:49:32 UTC
Patches proposed on the list:
https://listman.redhat.com/archives/libvir-list/2021-July/msg00129.html

Comment 4 khanicov 2021-07-15 13:17:31 UTC
Merged upstream as:

b0ef407c65 qemu: Check for existing file in namespace
cbcde4df3b virprocess: Return retval of the child on success, not 0
c39757f700 qemu: Do not erase duplicate devices from namespace if error occurs

v7.5.0-92-gc39757f700

Comment 5 Lili Zhu 2021-07-30 01:50:25 UTC
Pre-verified on libvirt v7.6.0-rc1-8-gf5c022a389 according to Comment 0

Comment 9 Lili Zhu 2021-08-05 04:54:54 UTC
Verify this bug with:
libvirt-daemon-7.6.0-1.module+el8.5.0+12097+2c77910b.x86_64

Testing result matches with expected result, mark the bug as verified.

Comment 11 errata-xmlrpc 2021-11-16 07:49:56 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:av 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-2021:4684


Note You need to log in before you can comment on or make changes to this bug.