It would be nice to be able to test the mediated device capabilities
without having physical hardware which supports it. The 'mtty' kernel
module presents a virtual parent device which is capable of creating
'fake' mediated devices, and as such it would be useful for testing.
However, the 'mtty' device is not part of an existing device subsystem
(e.g. PCI, etc), so libvirt ignores it and it does not get added to the
node device list. And because it does not get added to the node device
list, it cannot be used to create child mdevs using `virsh
nodedev-create`.
There is already a node device type capability
VIR_NODE_DEV_CAP_MDEV_TYPES that indicates whether a device supports
creating child mediated devices, but libvirt assumes that this is a
nested capability (in other words, it assumes that the primary
capability of a device is something like PCI). If we allow this
MDEV_TYPES capability to be a primary device capability, then we can
support virtual devices like 'mtty' as a parent for mediated devices.
See
https://bugzilla.redhat.com/show_bug.cgi?id=2107031
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/conf/node_device_conf.c | 41 +++++++++++++++++++++++++++-
src/conf/node_device_conf.h | 13 +++++++++
src/libvirt_private.syms | 2 ++
src/node_device/node_device_driver.c | 5 +++-
src/node_device/node_device_udev.c | 25 +++++++++++++++++
src/util/virmdev.c | 28 +++++++++++++++++++
src/util/virmdev.h | 4 +++
7 files changed, 116 insertions(+), 2 deletions(-)