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