[PATCH virt-manager v2 2/2] virtManager: change MDEV display names

Shalini Chellathurai Saroja shalini at linux.ibm.com
Fri Nov 12 10:51:49 UTC 2021


The MDEV devices listed in the "Add New Virtual Hardware" page, are a
concatenation of parent device name and MDEV device name, eg:
css_0_0_0014 mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014. The
parent name is duplicated in here, as the MDEV device name itself includes
a part of the parent name in libvirt version 7.8.0 and later. So, this patch
changes the MDEVs listed in "Add New Virtual Hardware" page to only display
the MDEV device
name(eg:mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014), when the
new naming convention is used.

Signed-off-by: Shalini Chellathurai Saroja <shalini at linux.ibm.com>
---
 virtManager/addhardware.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 13b899c3..132ba4e0 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -782,7 +782,9 @@ class vmmAddHardware(vmmGObjectUI):
                     if dev.xmlobj.name == subdev.xmlobj.parent:
                         prettyname += " (%s)" % subdev.pretty_name()
 
-            if devtype == "mdev":
+            # parent device names are appended with mdev names in
+            # libvirt 7.8.0
+            if devtype == "mdev" and len(prettyname) <= 41:
                 for parentdev in self.conn.list_nodedevs():
                     if dev.xmlobj.parent == parentdev.xmlobj.name:
                         prettyname = "%s %s" % (
-- 
2.30.2




More information about the virt-tools-list mailing list