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 2020241 - [nodedev-list] mdev naming changed breaking virt-install hostdev support
Summary: [nodedev-list] mdev naming changed breaking virt-install hostdev support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: virt-manager
Version: 8.6
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Jonathon Jongsma
QA Contact: smitterl
URL:
Whiteboard:
Depends On:
Blocks: 1954569 1995125
TreeView+ depends on / blocked
 
Reported: 2021-11-04 12:32 UTC by smitterl
Modified: 2022-05-10 14:26 UTC (History)
13 users (show)

Fixed In Version: virt-manager-3.2.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2023650 (view as bug list)
Environment:
Last Closed: 2022-05-10 13:54:55 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 195068 0 None None None 2021-11-04 13:37:11 UTC
Red Hat Issue Tracker RHELPLAN-101747 0 None None None 2021-11-04 12:40:12 UTC
Red Hat Product Errata RHBA-2022:1862 0 None None None 2022-05-10 13:55:41 UTC

Description smitterl 2021-11-04 12:32:49 UTC
Description of problem:
A node device of type mdev is given a different name with recent libvirt. It seems the parent device name is appended. This breaks virt-install and the mdev host device cannot be used for installation.

Version-Release number of selected component (if applicable):
libvirt-7.8.0-1.module+el8.6.0+12982+5e169f40.s390x

How reproducible:
100%


Steps to Reproduce:
1. Start a mediated device, e.g. for vfio_ccw (user doc[1])
2. virsh nodedev-list

Actual results:
mdev_1af2bd3e_f696_4c44_96a3_9806134ee045_0_0_26ac

Expected results:
mdev_1af2bd3e_f696_4c44_96a3_9806134ee045

Additional info:
[1]10.9 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/managing-virtual-devices_configuring-and-managing-virtualization#attaching-dasd-devices-to-virtual-machines-on-ibm-z_managing-virtual-devices
[2]As a result, virt-install with hostdev support will report 

"libvirt.libvirtError: internal error: Cannot parse uuid attribute of element <address>"

which is seems correct because virt-install can use node devices by their name as listed via 'virsh nodedev-list'. However, with the additional '0_0_26ac' the mdev's uuid is not correct:

# virt-install ... --hostdev mdev_1af2bd3e_f696_4c44_96a3_9806134ee045_0_0_26ac --print-xml

<domain type="kvm">
...
    <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
      <source>
        <address uuid="1af2bd3e-f696-4c44-96a3-9806134ee045-0-0-26ac"/>
      </source>
    </hostdev>

</domain>
...
[3] The expected result is shown with libvirt-daemon-7.6.0-3.module+el8.5.0+12510+80564ecf.s390x
[4] This is reproducible for vfio_ap mediated devices: mdev_b6c6d182_4537_46d4_af8f_e503b734faa9_matrix

Comment 1 smitterl 2021-11-04 12:45:53 UTC
The manpage doesn't explicitly say the name must be "mdev_(uuid.replace(-, _))" but IMO it the naming should not change and it's address for the host dev is really just the uuid, not the additional piece from the css (0.0.26ac):

"A node device key is generally specified by the bus  name  followed by   its   address,   using   underscores   between   all  components."

Comment 2 smitterl 2021-11-04 12:56:18 UTC
(In reply to smitterl from comment #1)
> The manpage doesn't explicitly say the name must be "mdev_(uuid.replace(-,
> _))" but IMO it the naming should not change and it's address for the host
> dev is really just the uuid, not the additional piece from the css
> (0.0.26ac):
... the additional piece, seemingly the parent device

Comment 4 smitterl 2021-11-04 13:47:26 UTC
Related upstream patch - https://github.com/virt-manager/virt-manager/pull/319

Comment 7 IBM Bug Proxy 2021-11-10 13:40:21 UTC
------- Comment From tstaudt.com 2021-11-10 08:33 EDT-------
The fix for this bug is sent to upstream mailing list for approval.
https://listman.redhat.com/archives/virt-tools-list/2021-November/msg00001.html

Comment 14 zhoujunqin 2021-12-01 06:46:21 UTC
Test on X86_64 platform: Failed

Package version:
virt-install-3.2.0-1.el8.noarch
virt-manager-3.2.0-1.el8.noarch
libvirt-7.9.0-1.module+el8.6.0+13150+28339563.x86_64
qemu-kvm-6.1.0-5.module+el8.6.0+13430+8fdd5f85.x86_64


Steps:
1. List node devices with capability mdev:

➜  ~ virsh nodedev-list --cap mdev 
mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0
mdev_341c76dc_ef0e_4d23_8a9d_a223d935ae40_0000_21_00_0

2. Dumpxml for the mdev device:

➜  ~ virsh nodedev-dumpxml mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0
<device>
  <name>mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0</name>
  <path>/sys/devices/pci0000:20/0000:20:01.1/0000:21:00.0/25069f48-ceee-4c6a-a6f8-156fd7cf3e11</path>
  <parent>pci_0000_21_00_0</parent>
  <driver>
    <name>vfio_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='nvidia-231'/>
    <uuid>25069f48-ceee-4c6a-a6f8-156fd7cf3e11</uuid>
    <iommuGroup number='122'/>
  </capability>
</device>

3. Install a VM via virt-install cmdline with the hostdev:mdev

➜  ~ virt-install --memory 4096 --location http://download.devel.redhat.com/rhel-8/composes/RHEL-8/RHEL-8.6.0-20211128.3/compose/BaseOS/x86_64/os/ --disk /home/virt-install.img,size=10  --hostdev mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0  --extra-args "inst.ks=http://fileshare.englab.nay.redhat.com/pub/section3/run/http-ks/ks-rhel8u4-x86_64.cfg console=ttyS0" --initrd-inject /home/ks-rhel8u4-x86_64.cfg
Using default --name rhel8

Starting install...
Retrieving file vmlinuz...                                                   | 9.9 MB  00:00:00     
Retrieving file initrd.img...                                                |  77 MB  00:00:01     
Allocating 'virt-install.img'                                                |  10 GB  00:00:00     
Removing disk 'virt-install.img'                                             |    0 B  00:00:00     
ERROR    internal error: qemu unexpectedly closed the monitor: 2021-12-01T06:38:47.819213Z qemu-kvm: warning: This feature depends on other features that were not requested: CPUID.8000000AH:EDX.nrip-save [bit 3]
2021-12-01T06:38:47.819220Z qemu-kvm: warning: This feature depends on other features that were not requested: CPUID.8000000AH:EDX.svme-addr-chk [bit 28]
2021-12-01T06:38:47.820043Z qemu-kvm: warning: This feature depends on other features that were not requested: CPUID.8000000AH:EDX.npt [bit 0]
2021-12-01T06:38:47.820061Z qemu-kvm: warning: This feature depends on other features that were not requested: CPUID.8000000AH:EDX.nrip-save [bit 3]
2021-12-01T06:38:47.820069Z qemu-kvm: warning: This feature depends on other features that were not requested: CPUID.8000000AH:EDX.svme-addr-chk [bit 28]
2021-12-01T06:38:47.846929Z qemu-kvm: -device vfio-pci,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/25069f48-ceee-4c6a-a6f8-156fd7cf3e11,display=off,ramfb=off,bus=pci.5,addr=0x0: Property 'vfio-pci.ramfb' not found
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start rhel8
otherwise, please restart your installation.


Test result:
As above, failed to install the VM with mdev device.
And I confirmed with the feature owner, we won't clone the Bug 2024435 from RHEL-9.0.0 to RHEL-8.6.0.
My plan is to verify this bug again with the next rebase of libvirt package and reset the ITM to 16, thanks.

So Sebastian, what's your opinion about resetting to ITM16, and feel free to reset it based on your plan.

Comment 15 zhoujunqin 2021-12-07 09:55:20 UTC
Try to verify this bug with following packages:
libvirt-7.10.0-1.module+el8.6.0+13502+4f24a11d.x86_64
virt-install-3.2.0-1.el8.noarch
virt-manager-3.2.0-1.el8.noarch
libvirt-7.10.0-1.module+el8.6.0+13502+4f24a11d.x86_64
qemu-kvm-6.1.0-5.module+el8.6.0+13430+8fdd5f85.x86_64


Steps:
1. List node devices with capability mdev:

➜  ~ virsh nodedev-list --cap mdev --inactive
mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0
mdev_341c76dc_ef0e_4d23_8a9d_a223d935ae40_0000_21_00_0
mdev_39be1f71_9b55_462a_a3d0_3db3d0f6c215_0000_41_00_0

➜  ~ virsh nodedev-start mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0
Device mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0 started

➜  ~ virsh nodedev-list --cap mdev                                             
mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0


2. Dumpxml for the mdev device:

➜  ~ virsh nodedev-dumpxml mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0
<device>
  <name>mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0</name>
  <path>/sys/devices/pci0000:20/0000:20:01.1/0000:21:00.0/25069f48-ceee-4c6a-a6f8-156fd7cf3e11</path>
  <parent>pci_0000_21_00_0</parent>
  <driver>
    <name>vfio_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='nvidia-231'/>
    <uuid>25069f48-ceee-4c6a-a6f8-156fd7cf3e11</uuid>
    <iommuGroup number='122'/>
  </capability>
</device>


3. Install a VM via virt-install cmdline with the hostdev:mdev

➜  ~ virt-install --memory 4096 --location http://download.devel.redhat.com/rhel-8/composes/RHEL-8/RHEL-8.6.0-20211128.3/compose/BaseOS/x86_64/os/ --disk /home/virt-install.img,size=10  --hostdev mdev_25069f48_ceee_4c6a_a6f8_156fd7cf3e11_0000_21_00_0  --extra-args "inst.ks=http://fileshare.englab.nay.redhat.com/pub/section3/run/http-ks/ks-rhel8u4-x86_64.cfg console=ttyS0" --initrd-inject /home/ks-rhel8u4-x86_64.cfg

Test result - VM can be installed and reboot successfully.

4. Check the mdev related XML file of the VM.

➜   virsh dumpxml rhel8
...
    <hostdev mode='subsystem' type='mdev' managed='yes' model='vfio-pci' display='off' ramfb='off'>
      <source>
        <address uuid='25069f48-ceee-4c6a-a6f8-156fd7cf3e11'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </hostdev>
...

Test result - The format of the UUID dumps from the VM keeps consistent with the output of step2.

Summary - It works as expected on the X86_64 platform, thanks.

Comment 16 zhoujunqin 2021-12-07 09:59:11 UTC
Hi Sebastian,
Could you help double-check it on the s390x platform, if it works well then I'll move this bug to VERIFIED status, thanks?

BR,
juzhou.

Comment 17 smitterl 2021-12-10 11:12:49 UTC
Verified with:
virt-manager-3.2.0-1.el8.noarch

# virt-install --memory 2049 --vcpus 2 --disk none --print-xml --hostdev mdev_cf7b0443_545b_4971_8c84_dbf7a8fbfd7b_0_0_26aa
<domain type="kvm">
  <name>vm1</name>
  <uuid>2cbda1e9-fb69-4f61-953e-22bd8cb2efe0</uuid>
  <memory>2098176</memory>
  <currentMemory>2098176</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
    <boot dev="hd"/>
  </os>
  <clock offset="utc"/>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <interface type="network">
      <source network="default"/>
      <mac address="52:54:00:3d:63:ad"/>
      <model type="virtio"/>
    </interface>
    <console type="pty">
      <target type="sclp"/>
    </console>
    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
      <source>
        <address uuid="cf7b0443-545b-4971-8c84-dbf7a8fbfd7b"/>
      </source>
    </hostdev>
  </devices>
</domain>

Comment 19 errata-xmlrpc 2022-05-10 13:54:55 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-manager 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-2022:1862


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