Fix bug RH2020241(https://bugzilla.redhat.com/show_bug.cgi?id=2020241) by Fetching MDEV UUID from MDEV node device XML attribute "uuid". The existing code parses MDEV node device UUID from MDEV name. The MDEV name is changed from mdev_uuid(eg: mdev_b204c698_6731_4f25_b5f4_894614a05ec0) to mdev_uuid_parent(eg: mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014) in libvirt version 7.8.0 and later. This breaks the virt-* tools support for vfio_ccw and vfio_ap devices. Signed-off-by: Shalini Chellathurai Saroja <shalini@xxxxxxxxxxxxx> --- virtinst/devices/hostdev.py | 2 +- virtinst/nodedev.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/virtinst/devices/hostdev.py b/virtinst/devices/hostdev.py index 121c6653..52c5b436 100644 --- a/virtinst/devices/hostdev.py +++ b/virtinst/devices/hostdev.py @@ -82,7 +82,7 @@ class DeviceHostdev(Device): _("Don't know how to generate nodedev for mdev type id '%s'") % nodedev.type_id) - self.uuid = nodedev.get_mdev_uuid() + self.uuid = nodedev.uuid else: raise ValueError(_("Unknown node device type %s") % nodedev) diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py index f54a311c..4fa2f7c3 100644 --- a/virtinst/nodedev.py +++ b/virtinst/nodedev.py @@ -92,9 +92,7 @@ class NodeDevice(XMLBuilder): name = XMLProperty("./name") parent = XMLProperty("./parent") device_type = XMLProperty("./capability/@type") - - def get_mdev_uuid(self): - return self.name[5:].replace('_', '-') + uuid = XMLProperty("./capability/uuid") def compare_to_hostdev(self, hostdev): if self.device_type == "pci": @@ -119,7 +117,7 @@ class NodeDevice(XMLBuilder): if hostdev.type != "mdev": return False - return _compare_uuid(self.get_mdev_uuid(), hostdev.uuid) + return _compare_uuid(self.uuid, hostdev.uuid) return False -- 2.30.2