Re: [PATCH 3/3] nodedev: trigger mdev device definition update on udev add and remove

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

 



On 3/16/22 8:32 AM, Michal Prívozník wrote:
On 3/15/22 09:56, Boris Fiuczynski wrote:
When nodedev objects are added and removed if possible check if mdev-types is
supported by the object and trigger a mdev device definition update to correct
the associated parent nodedevs.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
  src/node_device/node_device_udev.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index b0a5e6302c..e17373a0b0 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1440,6 +1440,10 @@ udevRemoveOneDeviceSysPath(const char *path)
      }
      virNodeDeviceObjEndAPI(&obj);
+ /* cannot check for mdev_types since they have already been removed */
+    if (nodeDeviceUpdateMediatedDevices() < 0)
+        VIR_WARN("mdevctl failed to updated mediated devices");

failed to update

+
      virObjectEventStateQueue(driver->nodeDeviceEventState, event);
      return 0;
  }
@@ -1507,6 +1511,7 @@ udevAddOneDevice(struct udev_device *device)
      bool persistent = false;
      bool autostart = false;
      bool is_mdev;
+    bool is_mdev_types = false;

has_mdev_cap perhaps?

def = g_new0(virNodeDeviceDef, 1); @@ -1562,8 +1567,12 @@ udevAddOneDevice(struct udev_device *device)
          event = virNodeDeviceEventUpdateNew(objdef->name);
virNodeDeviceObjSetActive(obj, true);
+    is_mdev_types = virNodeDeviceObjHasCap(obj, VIR_NODE_DEV_CAP_MDEV_TYPES);
      virNodeDeviceObjEndAPI(&obj);
+ if (is_mdev_types && nodeDeviceUpdateMediatedDevices() < 0)
+        VIR_WARN("mdevctl failed to updated mediated devices");

s/updated/update/

+
      ret = 0;
cleanup:


Otherwise looking good. I'll let Jonathon express his thoughts, but you
have my:

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Michal


looks ok to me with michal's suggestions

Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>




[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