RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1554876 - Device alias for input device do not take effect when hot-plugging
Summary: Device alias for input device do not take effect when hot-plugging
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-13 13:54 UTC by jiyan
Modified: 2019-07-02 05:14 UTC (History)
5 users (show)

Fixed In Version: libvirt-4.3.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:53:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:55:20 UTC

Description jiyan 2018-03-13 13:54:13 UTC
Description of problem:
Device alias for input device do not take effect when hot-plugging

Version:
kernel-3.10.0-860.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7.x86_64
libvirt-3.9.0-14.virtcov.el7.x86_64

Steps:
For Cold-plug:
1. Prepare a shutdown VM and a xml file describing input device
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "<input" 
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>

# cat input-0.xml 
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event8'/>
      <alias name='ua-input0'/>
    </input>

2. Cold-plug input device to VM
# virsh attach-device test1 input-0.xml --config
Device attached successfully

# virsh dumpxml test1 |grep "<input" -A4
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event8'/>
      <alias name='ua-input0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </input>

3. Start VM and check the dumpxml file
]# virsh start test1
Domain test1 started

# virsh dumpxml test1 |grep "<input" -A4
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event8'/>
      <alias name='input2'/>     ****changed here****
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </input>

For Hot-plug:
4. Prepare a running VM and hot-plug input device
# virsh domstate test1
running

# virsh dumpxml test1 |grep "<input" 
    <input type='mouse' bus='ps2'>
    <input type='keyboard' bus='ps2'>

# cat input-0.xml 
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event8'/>
      <alias name='ua-input0'/>
    </input>

5. Hot-plug input device and check the dumpxml file
# virsh attach-device test1 input-0.xml 
Device attached successfully

# virsh dumpxml test1 |grep "<input"  -A4
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event8'/>
      <alias name='input2'/>     ****changed here****
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </input>

Actual results:
As step-3 and step-5 show

Expected results:
'ua-' alias should take effect in dumpxml file 

Additional info:

Comment 2 Michal Privoznik 2018-03-13 14:19:06 UTC
I've just pushed the patch upstream:

commit a02a52751f72a1abac7d1024ecc3fcdb8b61a050
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Mar 13 13:01:11 2018 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Tue Mar 13 15:17:19 2018 +0100

    qemuAssignDeviceInputAlias: Be tolerant to pre-existent alias
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1554876
    
    This is missing in 6bc4a371cf and therefore we are effectively
    overwriting user provided aliases for <input/> devices.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v4.1.0-117-ga02a52751

Comment 4 jiyan 2018-05-28 08:29:14 UTC
Verified this bug in 'libvirt-4.3.0-1.el7.x86_64'

Version:
libvirt-4.3.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.3.x86_64
kernel-3.10.0-893.el7.x86_64

Steps:
1. Prepare a shutdown VM with default configuration for input device, and the following 5 files
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "<input" 
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>

# cat *.xml
<input type='passthrough' bus='virtio'>
<source evdev='/dev/input/event0'/>
<alias name='ua-cf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
</input>

<input type='keyboard' bus='usb'>
<alias name='ua-usbkeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
</input>

<input type='mouse' bus='usb'>
<alias name='ua-usbmousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
</input>

<input type='keyboard' bus='virtio'>
<alias name='ua-virtiokeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
</input>

<input type='mouse' bus='virtio'>
<alias name='ua-virtiomousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
</input>

2. Cold-plug the 5 files above to VM -- Cold-plugging cmd returns successful
# for i in *.xml; do virsh attach-device test1 $i --config; done
Device attached successfully

Device attached successfully

Device attached successfully

Device attached successfully

Device attached successfully

3. Checking inactive xml whether the alias still exists (VM is down) -- exists
# virsh dumpxml test1 |grep "<input" -A3
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event0'/>
      <alias name='ua-cf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </input>
    <input type='keyboard' bus='usb'>
      <alias name='ua-usbkeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='usb'>
      <alias name='ua-usbmousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='4'/>
    </input>
    <input type='keyboard' bus='virtio'>
      <alias name='ua-virtiokeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </input>
    <input type='mouse' bus='virtio'>
      <alias name='ua-virtiomousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </input>

4. Start the VM, after running, Checking inactive xml whether the alias still exists (VM is up) -- exists
# virsh dumpxml test1 |grep "<input" -A3
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event0'/>
      <alias name='ua-cf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </input>
    <input type='keyboard' bus='usb'>
      <alias name='ua-usbkeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='usb'>
      <alias name='ua-usbmousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='4'/>
    </input>
    <input type='keyboard' bus='virtio'>
      <alias name='ua-virtiokeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </input>
    <input type='mouse' bus='virtio'>
      <alias name='ua-virtiomousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </input>

5. Hot-unplug the 5 files in VM -- Hot-plugging cmd returns successful and no related xml info exists in active xml
# for i in *.xml; do virsh detach-device test1 $i; done
Device detached successfully

Device detached successfully

Device detached successfully

Device detached successfully

Device detached successfully

# virsh dumpxml test1 |grep "<input" -A3
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>

6. Hot-plug the 5 files to VM and check whether the alias still exists -- exists
# for i in *.xml; do virsh attach-device test1 $i; done
Device attached successfully

Device attached successfully

Device attached successfully

Device attached successfully

Device attached successfully

# virsh dumpxml test1 |grep "<input" -A3
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='passthrough' bus='virtio'>
      <source evdev='/dev/input/event0'/>
      <alias name='ua-cf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </input>
    <input type='keyboard' bus='usb'>
      <alias name='ua-usbkeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='usb'>
      <alias name='ua-usbmousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='usb' bus='0' port='4'/>
    </input>
    <input type='keyboard' bus='virtio'>
      <alias name='ua-virtiokeyboardcf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </input>
    <input type='mouse' bus='virtio'>
      <alias name='ua-virtiomousecf99c3a1-ed5c-4d68-898b-0d45bdb6913d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </input>

All the results are as expected, move this bug to be 'verified'.

Comment 6 errata-xmlrpc 2018-10-30 09:53:14 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.

https://access.redhat.com/errata/RHSA-2018:3113


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