43fe83
From 2ca27d701eea8770bd015c779d6fc959c5d7f176 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <2ca27d701eea8770bd015c779d6fc959c5d7f176.1381871412.git.jdenemar@redhat.com>
43fe83
From: "Daniel P. Berrange" <berrange@redhat.com>
43fe83
Date: Mon, 14 Oct 2013 16:45:28 +0100
43fe83
Subject: [PATCH] Improve log filtering in virLXCProcessReadLogOutputData
43fe83
43fe83
For
43fe83
43fe83
  https://bugzilla.redhat.com/show_bug.cgi?id=927072
43fe83
43fe83
Make the virLXCProcessReadLogOutputData method ignore the log
43fe83
lines about the container startup argv, ignore the generic
43fe83
error message from libvirt_lxc when lxcContainerMain fails
43fe83
and skip over blank lines.
43fe83
43fe83
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
43fe83
(cherry picked from commit 5a1cb1075af0c0ace466bf7cbb9d722dca812ec9)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/lxc/lxc_process.c | 16 +++++++++++++++-
43fe83
 1 file changed, 15 insertions(+), 1 deletion(-)
43fe83
43fe83
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
43fe83
index ccf86af..a5f1f35 100644
43fe83
--- a/src/lxc/lxc_process.c
43fe83
+++ b/src/lxc/lxc_process.c
43fe83
@@ -807,6 +807,20 @@ cleanup:
43fe83
 }
43fe83
 
43fe83
 
43fe83
+static bool
43fe83
+virLXCProcessIgnorableLogLine(const char *str)
43fe83
+{
43fe83
+    if (virLogProbablyLogMessage(str))
43fe83
+        return true;
43fe83
+    if (strstr(str, "PATH="))
43fe83
+        return true;
43fe83
+    if (strstr(str, "error receiving signal from container"))
43fe83
+        return true;
43fe83
+    if (STREQ(str, ""))
43fe83
+        return true;
43fe83
+    return false;
43fe83
+}
43fe83
+
43fe83
 static int
43fe83
 virLXCProcessReadLogOutputData(virDomainObjPtr vm,
43fe83
                                int fd,
43fe83
@@ -844,7 +858,7 @@ virLXCProcessReadLogOutputData(virDomainObjPtr vm,
43fe83
         /* Filter out debug messages from intermediate libvirt process */
43fe83
         while ((eol = strchr(filter_next, '\n'))) {
43fe83
             *eol = '\0';
43fe83
-            if (virLogProbablyLogMessage(filter_next)) {
43fe83
+            if (virLXCProcessIgnorableLogLine(filter_next)) {
43fe83
                 memmove(filter_next, eol + 1, got - (eol - buf));
43fe83
                 got -= eol + 1 - filter_next;
43fe83
             } else {
43fe83
-- 
43fe83
1.8.3.2
43fe83