[libvirt] [PATCH] Wait for udev events to be handled after removing veth

Cédric Bosdonnat cbosdonnat at suse.com
Thu Nov 26 08:15:57 UTC 2015


As per http://www.redhat.com/archives/libvir-list/2013-July/msg01279.html,
wait for udev events to be handled after removing a virtual NIC.
Any udev rule associated to NIC destroy could happen to run with a new
device with the same name that is being created.
---
 src/util/virnetdevveth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 6905168..c8a38fb 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -225,5 +225,8 @@ int virNetDevVethDelete(const char *veth)
     ret = 0;
  cleanup:
     virCommandFree(cmd);
+    /* Make sure the device is properly down: creating a new one
+     * with the same name could lead to troubles */
+    virFileWaitForDevices();
     return ret;
 }
-- 
2.1.4




More information about the libvir-list mailing list