From: Michal Privoznik <[email protected]>

Now that after previous commit the wait for udev to settle down
is done right after device creation, there's no need to have
additional wait in virNetDevMacVLanTapOpen(). It's effectively a
dead code. Remove it.

Signed-off-by: Michal Privoznik <[email protected]>
---
 src/util/virnetdevmacvlan.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 347148542d..bbc943cc7d 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -158,7 +158,6 @@ virNetDevMacVLanTapOpen(const char *ifname,
                         int *tapfd,
                         size_t tapfdSize)
 {
-    int retries = 10;
     int ret = -1;
     int ifindex;
     size_t i = 0;
@@ -172,20 +171,13 @@ virNetDevMacVLanTapOpen(const char *ifname,
     for (i = 0; i < tapfdSize; i++) {
         int fd = -1;
 
-        while (fd < 0) {
-            if ((fd = open(tapname, O_RDWR)) >= 0) {
-                tapfd[i] = fd;
-            } else if (retries-- > 0) {
-                /* may need to wait for udev to be done */
-                g_usleep(20000);
-            } else {
-                /* However, if haven't succeeded, quit. */
-                virReportSystemError(errno,
-                                     _("cannot open macvtap tap device %1$s"),
-                                     tapname);
-                goto cleanup;
-            }
+        if ((fd = open(tapname, O_RDWR)) < 0) {
+            virReportSystemError(errno,
+                                 _("cannot open macvtap tap device %1$s"),
+                                 tapname);
+            goto cleanup;
         }
+        tapfd[i] = fd;
     }
 
     ret = 0;
-- 
2.52.0

Reply via email to