[libvirt] [PATCH 08/21] Fix duplicating logging of errors in libvirtd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The libvirt default error handling callback will print all errors
to stderr. The libvirtd default logging callback will do the same.
Set a no-op error handling callback in libvirtd to prevent this
duplication

* daemon/libvirtd.c: Register a no-op error handling function
---
 daemon/libvirtd.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 252d527..ab0c88c 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -776,6 +776,12 @@ static int qemudInitPaths(struct qemud_server *server,
     return ret;
 }
 
+static void virshErrorHandler(void *opaque ATTRIBUTE_UNUSED, virErrorPtr err ATTRIBUTE_UNUSED)
+{
+    /* Don't do anything, since logging infrastructure already
+     * took care of reporting the error */
+}
+
 static struct qemud_server *qemudInitialize(int sigread) {
     struct qemud_server *server;
 
@@ -2994,6 +3000,9 @@ int main(int argc, char **argv) {
     if (remoteReadConfigFile (server, remote_config_file) < 0)
         goto error2;
 
+    /* Disable error func, now logging is setup */
+    virSetErrorFunc(NULL, virshErrorHandler);
+
     if (virEventAddHandleImpl(sigpipe[0],
                               VIR_EVENT_HANDLE_READABLE,
                               qemudDispatchSignalEvent,
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]