mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
nodedev: trigger mdev device definition update on udev add and remove
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@linux.ibm.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
06aebe8f9a
commit
8efdf5b083
@ -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 update mediated devices");
|
||||
|
||||
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 has_mdev_types = false;
|
||||
|
||||
def = g_new0(virNodeDeviceDef, 1);
|
||||
|
||||
@ -1562,8 +1567,12 @@ udevAddOneDevice(struct udev_device *device)
|
||||
event = virNodeDeviceEventUpdateNew(objdef->name);
|
||||
|
||||
virNodeDeviceObjSetActive(obj, true);
|
||||
has_mdev_types = virNodeDeviceObjHasCap(obj, VIR_NODE_DEV_CAP_MDEV_TYPES);
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
|
||||
if (has_mdev_types && nodeDeviceUpdateMediatedDevices() < 0)
|
||||
VIR_WARN("mdevctl failed to update mediated devices");
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user