[libvirt] [PATCH] give a more useful diagnostic for tap-add failure w/ENOTSUP

Jim Meyering jim at meyering.net
Tue Jul 8 12:07:32 UTC 2008


I invoked virt-isntall with --network=bridge:eth1
rather than --network=bridge:br1 and got the latter
(current) diagnostic below.  This change makes it so
in this relatively common case people get a slightly
more understandable diagnostic.

>From 3d6dc8442fd9f1b0915c232040200154832fdf51 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 8 Jul 2008 13:58:10 +0200
Subject: [PATCH] give a more useful diagnostic for tap-add failure w/ENOTSUP

* src/qemu_conf.c (qemudNetworkIfaceConnect):
Suggestion from Daniel P. Berrange.
---
 src/qemu_conf.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 17f0162..4b8c01e 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -2304,9 +2304,17 @@ qemudNetworkIfaceConnect(virConnectPtr conn,

     if ((err = brAddTap(driver->brctl, brname,
                         ifname, BR_IFNAME_MAXLEN, &tapfd))) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     _("Failed to add tap interface '%s' to bridge '%s' : %s"),
-                         ifname, brname, strerror(err));
+        if (errno == ENOTSUP) {
+            /* In this particular case, give a better diagnostic. */
+            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+                             _("Failed to add tap interface to bridge. "
+                               "%s is not a bridge device"), brname);
+        } else {
+            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+                             _("Failed to add tap interface '%s' "
+                               "to bridge '%s' : %s"),
+                             ifname, brname, strerror(err));
+        }
         goto error;
     }

--
1.5.6.2.221.gb589




More information about the libvir-list mailing list