]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nodedev: fix parent device of inactive mdevs
authorJonathon Jongsma <jjongsma@redhat.com>
Wed, 7 Jul 2021 21:29:28 +0000 (16:29 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 19 Jul 2021 09:25:43 +0000 (11:25 +0200)
commit51fbbfdce8141d5a25edcf66ba3a95ac23b29f94
treeb9ffd65fa10e7213d5d7523ba4fc6ef420d7dfb9
parent00d34a085cea57837b82545cd0b801bf70d757bb
nodedev: fix parent device of inactive mdevs

Inactive mdevs were simply formatting their parent name as the value
received from mdevctl rather than looking up the libvirt nodedev name of
the parent device. This resulted in a parent value of e.g.
'0000:5b:00.0' instead of 'pci_0000_5b_00_0'. This prevented defining a
new mdev device from the output of nodedev-dumpxml.

Unfortunately, it's not simple to fix this comprehensively due to the
fact that mdevctl supports defining (inactive) mdevs for parent devices
that do not actually exist on the host (yet). So for those persistent
mdev definitions that do not have a valid parent in the device list, the
parent device will be set to the root "computer" device.

Unfortunately, because the value of the 'parent' field now depends on
the configuration of the host, the mdevctl parsing test will output
'computer' for all test devices. Fixing this would require a more
extensive mock test environment.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1979761
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/node_device/node_device_driver.c
tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml