]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnetdevtap: Add better error message for a possible common user error
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 4 Sep 2024 08:18:41 +0000 (10:18 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 4 Sep 2024 10:21:20 +0000 (12:21 +0200)
When users pre-create a tap device to use with multiqueue interface that
has `managed="no"`, change the error so that it does not indicate we are
trying to create the device, and on top of that hint at the most
probable error cause.

Resolves: https://issues.redhat.com/browse/RHEL-55749
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnetdevtap.c

index 55536b5f4be20b7db448b9569a1f6512f6348556..3d7f6805996e10ec4bb4ac29e5093874364dc0fe 100644 (file)
@@ -230,9 +230,16 @@ int virNetDevTapCreate(char **ifname,
         }
 
         if (ioctl(fd, TUNSETIFF, &ifr) < 0) {
-            virReportSystemError(errno,
-                                 _("Unable to create tap device %1$s"),
-                                 *ifname);
+            if (flags & VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING &&
+                tapfdSize > 0) {
+                virReportSystemError(errno,
+                                     _("Unable to create multiple fds for tap device %1$s (maybe existing device was created without multi_queue flag)"),
+                                     *ifname);
+            } else {
+                virReportSystemError(errno,
+                                     _("Unable to create tap device %1$s"),
+                                     *ifname);
+            }
             goto cleanup;
         }