]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virnetdevtap: Produce more helpful error message in virNetDevTapCreate()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Jan 2026 09:54:21 +0000 (10:54 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Jan 2026 15:52:03 +0000 (16:52 +0100)
Since v10.8.0-rc1~133 a different error is reported from
virNetDevTapCreate() when the tap device already exists (and
<interface/> XML specifies managed='no'). But the change covers
only one scenario: if multiqueue was requested in <inteface/> XML
BUT pre-created tap device doesn't have multi_queue flag set. The
opposite scenario: if the device has the multi_queue flag set BUT
no multiqueue was specified in the XML. Until now.

Resolves: https://issues.redhat.com/browse/RHEL-118303
Fixes: f6fb097e11a15e390d989411b2660ead0d1a7c10
Fixes: 465a38154f0cfc31d62c4105770e1f4a9599a611
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virnetdevtap.c

index b709d76cc724cdd4850b3f0c1e10b878f1f22a8f..e3a6209642882cff61674f48ef89832a23f2c1ce 100644 (file)
@@ -230,11 +230,16 @@ int virNetDevTapCreate(char **ifname,
         }
 
         if (ioctl(fd, TUNSETIFF, &ifr) < 0) {
-            if (flags & VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING &&
-                tapfdSize > 1) {
-                virReportSystemError(errno,
-                                     _("Unable to create multiple fds for tap device %1$s (maybe existing device was created without multi_queue flag)"),
-                                     *ifname);
+            if (flags & VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING) {
+                if (tapfdSize > 1) {
+                    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 set tap device %1$s (maybe existing device was created with multi_queue flag but device XML lacks 'queues' greater than one)"),
+                                         *ifname);
+                }
             } else {
                 virReportSystemError(errno,
                                      _("Unable to create tap device %1$s"),