[PATCH virt-manager v2 0/4] Enable MDEV support

Cole Robinson crobinso at redhat.com
Tue Jun 1 21:13:12 UTC 2021


On 5/31/21 3:54 PM, Shalini Chellathurai Saroja wrote:
> Enable support for mediated devices in virt-xml tool and virt-manager
> GUI tool.
> 

Thanks! I pushed 1-3 with a small tweak to patch #1 to keep code
coverage at 100%.

In order to get the parent naming stuff in addhardware.py to trigger I
needed to change things a bit:

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 2df84bf5..13b899c3 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -783,9 +783,10 @@ class vmmAddHardware(vmmGObjectUI):
                         prettyname += " (%s)" % subdev.pretty_name()

             if devtype == "mdev":
-                for subdev in self.conn.filter_nodedevs("mdev"):
-                    if dev.xmlobj.name == subdev.xmlobj.parent:
-                        prettyname += " (%s)" % subdev.pretty_name()
+                for parentdev in self.conn.list_nodedevs():
+                    if dev.xmlobj.parent == parentdev.xmlobj.name:
+                        prettyname = "%s %s" % (
+                                parentdev.pretty_name(), prettyname)

             model.append([dev.xmlobj, prettyname])


Was it working in your code before that, like on a real system with mdev
devices? Or was the Add Hardware->MDEV only listing devices with name
`mdev_$UUID` ?

The point of this code is to give more descriptive names to what we list
in the UI, if we can help it. The names for 'mdev' devices are not
descriptive. Their type id=XXX values are a bit better:
vfio_ap-passthrough, nvidia-11, etc. Maybe we can just use that? The
parent devices have a bit more info under <capability><type><name> but
it's not clear if that's always available. Maybe we can get away with
just using the <type id=XXX> value in the mdev pretty_name() definition

Thanks,
Cole




More information about the virt-tools-list mailing list