]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
node_device_udev: handle move events
authorMark Asselstine <mark.asselstine@windriver.com>
Thu, 16 Apr 2020 15:57:45 +0000 (11:57 -0400)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 20 Apr 2020 13:25:52 +0000 (15:25 +0200)
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>
src/node_device/node_device_udev.c

index 8451903e8a9927b309e445f947a229c86cbe8330..3149de8321989db783dc3e5b7cbf83310f180bcd 100644 (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;
 }