[PATCH 1/2] node_device_udev: handle move events

Mark Asselstine mark.asselstine at windriver.com
Thu Apr 16 15:57:45 UTC 2020


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 at windriver.com>
---
 src/node_device/node_device_udev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 8451903e8a..3149de8321 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -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;
 }
 
-- 
2.20.1





More information about the libvir-list mailing list