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

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@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

On Tue, Jul 08, 2008 at 02:07:32PM +0200, Jim Meyering wrote:
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.
Looks fine to me, +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Jul 08, 2008 at 02:07:32PM +0200, Jim Meyering wrote:
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.
ACK. I've seen this original error report from various people and never realized what it was caused by until today. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Tue, Jul 08, 2008 at 02:07:32PM +0200, Jim Meyering wrote:
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.
ACK. I've seen this original error report from various people and never realized what it was caused by until today.
committed
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering