libvirt/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml
Jonathon Jongsma a9c1febcf4 nodedev: fix xml output for mdev parents in test suite
Commit 51fbbfdce8 attempted to get the proper nodedev name for the
parent of an defined mdev by traversing the filesystem and looking for a
device that had the appropriate sysfs path.  This works, but it would be
cleaner to to avoid mucking around in the filesystem and instead just
just examine the list of devices we have in memory.

We already had a function nodeDeviceFindAddressByName() which constructs
an address for parent device in a format that can be used with mdevctl.
So if we refactor this function into a a function that simply formats an
address for an arbitrary virNodeDeviceObj*, then we can use this
function as a predicate for our new virNodeDeviceObjListFind() function
from the previous commit. This will search our list of devices for one
whose address matches the address we get from mdevctl.

One nice benefit of this approach is that our test cases will now
display xml output with the proper parent name for mdevs (assuming that
we've added the appropriate mock parent devices to the test driver).
Previously they just displayed 'computer' for the parent because the
alternative would have required specially constructing a mock filesystem
environment with a sysfs that mapped to the appropriate parent.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-08-06 15:02:23 -05:00

44 lines
1.4 KiB
XML

<device>
<name>mdev_200f228a_c80a_4d50_bfb7_f5a0e4e34045</name>
<parent>pci_0000_00_02_0</parent>
<capability type='mdev'>
<type id='i915-GVTg_V5_4'/>
<uuid>200f228a-c80a-4d50-bfb7-f5a0e4e34045</uuid>
<iommuGroup number='0'/>
</capability>
</device>
<device>
<name>mdev_de807ffc_1923_4d5f_b6c9_b20ecebc6d4b</name>
<parent>pci_0000_00_02_0</parent>
<capability type='mdev'>
<type id='i915-GVTg_V5_4'/>
<uuid>de807ffc-1923-4d5f-b6c9-b20ecebc6d4b</uuid>
<iommuGroup number='0'/>
</capability>
</device>
<device>
<name>mdev_435722ea_5f43_468a_874f_da34f1217f13</name>
<parent>pci_0000_00_02_0</parent>
<capability type='mdev'>
<type id='i915-GVTg_V5_8'/>
<uuid>435722ea-5f43-468a-874f-da34f1217f13</uuid>
<iommuGroup number='0'/>
<attr name='testattr' value='42'/>
</capability>
</device>
<device>
<name>mdev_783e6dbb_ea0e_411f_94e2_717eaad438bf</name>
<parent>ap_matrix</parent>
<capability type='mdev'>
<type id='vfio_ap-passthrough'/>
<uuid>783e6dbb-ea0e-411f-94e2-717eaad438bf</uuid>
<iommuGroup number='0'/>
<attr name='assign_adapter' value='5'/>
<attr name='assign_adapter' value='6'/>
<attr name='assign_domain' value='0xab'/>
<attr name='assign_control_domain' value='0xab'/>
<attr name='assign_domain' value='4'/>
<attr name='assign_control_domain' value='4'/>
</capability>
</device>