[PATCH] node_device: Use "udev" monitor source

Daniel P. Berrangé berrange at redhat.com
Tue Nov 17 12:51:05 UTC 2020


On Tue, Nov 17, 2020 at 01:29:47PM +0100, Michal Privoznik wrote:
> In v6.3.0-rc1~67 I've made a switch: instead of listening on udev
> events the nodedev driver started listening for kernel events.
> This was because when a device changes its name (e.g. NICs) we
> will get "move" event with DEVPATH_OLD property set, which we can
> then use to remove the old device and thus keep our internal list
> up to date. The switch to "kernel" source was made because if the
> old NICs naming (eth0, eth1, ...) is enabled (e.g. via
> net.ifnames=0 on the kernel cmd line) then udev overwrites the
> property with the new name making our internal list go out of
> sync. Interestingly, when the od NICs naming is not enabled then
> the DEVPATH_OLD contains the correct value.

I don't see any difference in properties regardless of net.ifnames
is 0 or 1. In both cases, there is DEVPATH + DEVPAT_OLD, and
INTERFACE has the new NIC name.  Can you actually reproduce the
original problem with net.ifnames=0 ?  If so, which distro ?

> 
> But as it turns out, "kernel" source might be missing some other
> important properties, e.g. USB vendor/product IDs. Therefore,
> switch back to "udev" source and wish the best of luck to users
> using the old NICs naming.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1897625
> Fixes: 9a13704818e4a018723e0ec5b9e97b176f1c8584
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/node_device/node_device_udev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 65f312d8f4..dec19a3166 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1983,7 +1983,7 @@ nodeStateInitialize(bool privileged,
>  
>      virObjectLock(priv);
>  
> -    priv->udev_monitor = udev_monitor_new_from_netlink(udev, "kernel");
> +    priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
>      if (!priv->udev_monitor) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("udev_monitor_new_from_netlink returned NULL"));

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list