[PATCH] virnetdevtap: Produce more helpful error message in virNetDevTapCreate()

Michal Privoznik via Devel posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/94390fc1ef221addb7dc3d07bd06ce0dcf686e06.1768903377.git.mprivozn@redhat.com
src/util/virnetdevtap.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
[PATCH] virnetdevtap: Produce more helpful error message in virNetDevTapCreate()
Posted by Michal Privoznik via Devel 1 week, 5 days ago
From: Michal Privoznik <mprivozn@redhat.com>

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 multique 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 multique was specified in the XML is missing. Until now.

Resolves: https://issues.redhat.com/browse/RHEL-118303
Fixes: f6fb097e11a15e390d989411b2660ead0d1a7c10
Fixes: 465a38154f0cfc31d62c4105770e1f4a9599a611
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virnetdevtap.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index b709d76cc7..e3a6209642 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -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"),
-- 
2.52.0
Re: [PATCH] virnetdevtap: Produce more helpful error message in virNetDevTapCreate()
Posted by Ján Tomko via Devel 1 week, 5 days ago
On a Tuesday in 2026, Michal Privoznik via Devel wrote:
>From: Michal Privoznik <mprivozn@redhat.com>
>

Consider:
s/more helpful/helpfuler/
in the commit summary

>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 multique was requested in <inteface/> XML

*multiqueue

>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 multique was specified in the XML is missing. Until now.

*multiqueue

d/ is missing/

>
>Resolves: https://issues.redhat.com/browse/RHEL-118303
>Fixes: f6fb097e11a15e390d989411b2660ead0d1a7c10
>Fixes: 465a38154f0cfc31d62c4105770e1f4a9599a611
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/util/virnetdevtap.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano