From 0c146b250384ddddcefd2cc0d76b9e808377ebe5 Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Tue, 26 Oct 2021 14:18:40 -0500 Subject: Handle new nodedev name for mediated devices libvirt recently changed the nodedev names for mediated devices due to the fact that mdevctl supports defining multiple mediated devices with the same UUID as long as only one is active at a time. This means that the nodedev name changed from the format 'mdev_$UUID' to the format 'mdev_$UUID_$PARENT'. Unfortunately, virt-install was parsing the nodedev name to extract the UUID of a mediated device. This fails with the new name format. Fortunately, in libvirt 7.3.0, a field was added to the xml schema for mdev devices, so we can simply use this instead, and fall back to the name parsing if it doesn't exist. Signed-off-by: Jonathon Jongsma --- virtinst/nodedev.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'virtinst/nodedev.py') diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py index f54a311c..248723b9 100644 --- a/virtinst/nodedev.py +++ b/virtinst/nodedev.py @@ -94,6 +94,12 @@ class NodeDevice(XMLBuilder): device_type = XMLProperty("./capability/@type") def get_mdev_uuid(self): + # libvirt 7.3.0 added a element to the nodedev xml for mdev + # types. For older versions, we unfortunately have to parse the nodedev + # name, which uses the format "mdev_$UUID_WITH_UNDERSCORES" + if self.uuid is not None: + return self.uuid + return self.name[5:].replace('_', '-') def compare_to_hostdev(self, hostdev): @@ -191,6 +197,7 @@ class NodeDevice(XMLBuilder): # type='mdev' options type_id = XMLProperty("./capability/type/@id") + uuid = XMLProperty("./capability/uuid") def _AddressStringToHostdev(conn, addrstr): -- cgit v1.2.1