node_device_udev: handle move events

It is possible and common to rename some devices, this is especially
true for ethernet devices such as veth pairs.

In the udevEventHandleThread() we will be notified of this change but
currently we only process "add", "change" and "remove"
events. Renaming a device such as above results in a "move" event, not
a "remove" followed by and "add" or vise versa. This change will add
the new/destination device to our records but unfortunately there is
no usable mechanism to identify the old/source device to remove it
from the records. So this is admittedly only a partial fix.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Mark Asselstine 2020-04-16 11:57:45 -04:00 committed by Michal Privoznik
parent a7f0a3a272
commit abbd3a3184

View File

@ -1499,6 +1499,11 @@ udevHandleOneDevice(struct udev_device *device)
if (STREQ(action, "remove"))
return udevRemoveOneDevice(device);
if (STREQ(action, "move")) {
/* TODO: implement a way of finding and removing the old device */
return udevAddOneDevice(device);
}
return 0;
}