[PATCH] nodedev: transient mdev update on nodeDeviceCreateXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Update the optional mdev attributes on the new created nodedev object as
they otherwise would not get set until the next mdevctl update cycle.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
 src/node_device/node_device_driver.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index a2d0600560..5134d246f3 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -847,6 +847,9 @@ static virNodeDevicePtr
 nodeDeviceCreateXMLMdev(virConnectPtr conn,
                         virNodeDeviceDef *def)
 {
+    virNodeDeviceObj *obj;
+    virNodeDeviceDef *new_def;
+    virNodeDevicePtr device;
     g_autofree char *uuid = NULL;
 
     if (!def->parent) {
@@ -864,8 +867,19 @@ nodeDeviceCreateXMLMdev(virConnectPtr conn,
         def->caps->data.mdev.uuid = g_steal_pointer(&uuid);
     }
 
-    return nodeDeviceFindNewMediatedDevice(conn, def->caps->data.mdev.uuid,
-                                           def->caps->data.mdev.parent_addr);
+    device = nodeDeviceFindNewMediatedDevice(conn, def->caps->data.mdev.uuid,
+                                             def->caps->data.mdev.parent_addr);
+    /* check on def for attributes and try update */
+    if (def->caps->data.mdev.nattributes > 0) {
+        /* ignore failures as mdevctl updates will recover later */
+        if (!(obj = nodeDeviceObjFindByName(device->name)))
+            return device;
+        new_def = virNodeDeviceObjGetDef(obj);
+        nodeDeviceDefCopyFromMdevctl(new_def, def);
+        virNodeDeviceObjEndAPI(&obj);
+    }
+
+    return device;
 }
 
 
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux