summaryrefslogtreecommitdiff
path: root/virtinst/nodedev.py
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2021-10-26 14:18:40 -0500
committerDaniel Berrangé <berrange@redhat.com>2021-11-10 14:58:07 +0000
commit0c146b250384ddddcefd2cc0d76b9e808377ebe5 (patch)
tree027316add2170c2e952405cdbea2fdf563502e59 /virtinst/nodedev.py
parent56ca569dfc012e6a2b829ed6780c07f5d3f7ad27 (diff)
downloadvirt-manager-0c146b250384ddddcefd2cc0d76b9e808377ebe5.tar.gz
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 <uuid> 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 <jjongsma@redhat.com>
Diffstat (limited to 'virtinst/nodedev.py')
-rw-r--r--virtinst/nodedev.py7
1 files changed, 7 insertions, 0 deletions
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 <uuid> 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):