[libvirt PATCH] nodedev: Handle inactive mdevs with the same UUID

Jonathon Jongsma jjongsma at redhat.com
Tue Jul 6 19:05:17 UTC 2021


Unfortunately, mdevctl supports defining more than one mdev with the
same UUID as long as they have different parent devices. So we can't use
the UUID alone as a way to uniquely identify these node devices. Append
the parent name to ensure uniqueness. For example:

    Before: mdev_88a6b868_46bd_4015_8e5b_26107f82da38
    After:  mdev_88a6b868_46bd_4015_8e5b_26107f82da38_0000_00_02_0

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1979440

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
QUESTION: Is there any expectation of stability in these device names? I'm not
sure to what extent these changes might affect users. Given that support for
persistent mdevs is fairly new, there are likely not many users yet.

 src/node_device/node_device_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index b4dd57e5f4..89dc704162 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1038,7 +1038,7 @@ nodeDeviceGetMdevctlListCommand(bool defined,
 
 static void mdevGenerateDeviceName(virNodeDeviceDef *dev)
 {
-    nodeDeviceGenerateName(dev, "mdev", dev->caps->data.mdev.uuid, NULL);
+    nodeDeviceGenerateName(dev, "mdev", dev->caps->data.mdev.uuid, dev->parent);
 }
 
 
-- 
2.31.1




More information about the libvir-list mailing list