[PATCH 3/3] udevHandleOneDevice: Remove old instance of device on "move"

Martin Kletzander mkletzan at redhat.com
Wed Apr 22 09:44:25 UTC 2020

On Mon, Apr 20, 2020 at 04:20:41PM +0200, Michal Privoznik wrote:
>When a device is "move"-d (this basically means it was renamed),
>we add the new device onto our list but keep the old there too.
>Fortunately, udev sets this DEVPATH_OLD property which points to
>the old device path. We can use it to remove the old instance.
>To test this try renaming an interface, for instance:
>  # ip link set tunl0 name tunl1
>  # ip link set tunl1 name tunl0
>One problem with udev is that it sends old ifname in INTERFACE
>property, which creates a problem for us, the property is where
>we get the ifname from and use it then to query all kind of info
>about the interface. Well, if it is non-existent then we can't
>query anything. This happens if ifname rename is suppressed
>(net.ifnames=0 on kernel cmd line for instance). Fortunately, we
>can use "kernel" source for udev events which has always the
>fresh info.
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200422/95b5cbee/attachment-0001.sig>

More information about the libvir-list mailing list