From: Michal Privoznik <[email protected]>

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 <[email protected]>
---
 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

Reply via email to