Bug 1438431

Summary: libvirt doesn't pass id= for mdev devices
Product: Red Hat Enterprise Linux 7 Reporter: Gerd Hoffmann <kraxel>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: zhe peng <zpeng>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: dyuan, fjin, jishao, pkrempa, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.2.0-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:05:54 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:

Description Gerd Hoffmann 2017-04-03 12:16:39 UTC
Description of problem:
$subject

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

Steps to Reproduce:
1. boot guest with mdev.
2. check qemu command line.

Actual results:
"-device vfio-pci,sysfsdev=/sys/bus/mdev/devices/88e48736-0a6d-431f-b71e-8556c184b389,bus=pci.0,addr=0x5"

Expected results:
"-device vfio-pci,id=hostdev1,sysfsdev=/sys/bus/mdev/devices/88e48736-0a6d-431f-b71e-8556c184b389,bus=pci.0,addr=0x5"

Additional info:
domain xml correctly lists the name:
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
      <source>
        <address uuid='88e48736-0a6d-431f-b71e-8556c184b389'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>

Comment 2 Erik Skultety 2017-04-04 06:46:28 UTC
Fixed upstream by:

commit c3272e5e12e0bfd43b8101b73ae13d264c13337f
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Apr 3 16:10:00 2017 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Apr 4 08:15:43 2017 +0200

    qemu: Add device id for mediated devices on qemu command line
    
    Like all devices, add the 'id' option for mdevs as well. Patch also
    adjusts the test accordingly.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438431
    
    Signed-off-by: Erik Skultety <eskultet>

v3.2.0-22-gc3272e5e1

Comment 5 zhe peng 2017-05-24 09:07:04 UTC
verify with build:
libvirt-3.2.0-5.virtcov.el7.x86_64
qemu-kvm-rhev-2.9.0-6.el7.x86_64
kernel-3.10.0-663.el7.x86_64

1. create a guest with xml:
 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
      <source>
        <address uuid='9ea4eb07-c4a8-41d1-bd4a-850d1b0bef74'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>

2. start the guest and check qemu cmd line
#ps -ef |grep kvm
....
-device vfio-pci,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/9ea4eb07-c4a8-41d1-bd4a-850d1b0bef74,bus=pci.0,addr=0x9 
....

move to verified.

Comment 6 errata-xmlrpc 2017-08-02 00:05:54 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/RHEA-2017:1846

Comment 7 errata-xmlrpc 2017-08-02 01:30:05 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/RHEA-2017:1846