]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix bridge/tap system error reporting
authorMark McLoughlin <markmc@redhat.com>
Tue, 18 Aug 2009 13:15:58 +0000 (14:15 +0100)
committerMark McLoughlin <markmc@redhat.com>
Tue, 18 Aug 2009 13:15:58 +0000 (14:15 +0100)
* src/qemu_conf.c, src/uml_conf.c: use virReportSystemError() to report
  system errors

src/qemu_conf.c
src/uml_conf.c

index bcdab115f7eb42822bb09b3ec234eb9fbc7a2d50..22f5edd248c87cdd55d033acd6ae721a384319bd 100644 (file)
@@ -1060,11 +1060,9 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
         return -1;
     }
 
-    char ebuf[1024];
     if (!driver->brctl && (err = brInit(&driver->brctl))) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot initialize bridge support: %s"),
-                         virStrerror(err, ebuf, sizeof ebuf));
+        virReportSystemError(conn, err, "%s",
+                             _("cannot initialize bridge support"));
         return -1;
     }
 
@@ -1092,14 +1090,13 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
                              _("Failed to add tap interface to bridge. "
                                "%s is not a bridge device"), brname);
         } else if (template_ifname) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Failed to add tap interface to bridge '%s' : %s"),
-                             brname, virStrerror(err, ebuf, sizeof ebuf));
+            virReportSystemError(conn, err,
+                                 _("Failed to add tap interface to bridge '%s'"),
+                                 brname);
         } else {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Failed to add tap interface '%s' "
-                               "to bridge '%s' : %s"),
-                             net->ifname, brname, virStrerror(err, ebuf, sizeof ebuf));
+            virReportSystemError(conn, err,
+                                 _("Failed to add tap interface '%s' to bridge '%s'"),
+                                 net->ifname, brname);
         }
         if (template_ifname)
             VIR_FREE(net->ifname);
index a4c434f8a88c31201df6bfc518718d9eef4c6ad0..838feddf61c17c3be2acbb15f7397b308aa405f4 100644 (file)
@@ -110,10 +110,8 @@ umlConnectTapDevice(virConnectPtr conn,
     int err;
 
     if ((err = brInit(&brctl))) {
-        char ebuf[1024];
-        umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                       _("cannot initialize bridge support: %s"),
-                       virStrerror(err, ebuf, sizeof ebuf));
+        virReportSystemError(conn, err, "%s",
+                             _("cannot initialize bridge support"));
         goto error;
     }
 
@@ -135,16 +133,13 @@ umlConnectTapDevice(virConnectPtr conn,
                            _("Failed to add tap interface to bridge. "
                              "%s is not a bridge device"), bridge);
         } else if (template_ifname) {
-            char ebuf[1024];
-            umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to add tap interface to bridge '%s' : %s"),
-                           bridge, virStrerror(err, ebuf, sizeof ebuf));
+            virReportSystemError(conn, err,
+                                 _("Failed to add tap interface to bridge '%s'"),
+                                 bridge);
         } else {
-            char ebuf[1024];
-            umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to add tap interface '%s' "
-                             "to bridge '%s' : %s"),
-                           net->ifname, bridge, virStrerror(err, ebuf, sizeof ebuf));
+            virReportSystemError(conn, err,
+                                 _("Failed to add tap interface '%s' to bridge '%s'"),
+                                 net->ifname, bridge);
         }
         if (template_ifname)
             VIR_FREE(net->ifname);