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

[libvirt] [PATCH 3/3] Convert QEMU driver to use virLogProbablyLogMessage



From: "Daniel P. Berrange" <berrange redhat com>

The current QEMU code for skipping log messages only skips over
'debug' message, switch to virLogProbablyLogMessage to make sure
it skips over all of them
---
 src/qemu/qemu_process.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9f1507a..3196dbc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1434,19 +1434,11 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
 {
     int retries = (timeout*10);
     int got = 0;
-    char *debug = NULL;
     int ret = -1;
     char *filter_next = buf;
 
     buf[0] = '\0';
 
-    /* This relies on log message format generated by virLogFormatString() and
-     * might need to be modified when message format changes. */
-    if (virAsprintf(&debug, ": %d: debug : ", vm->pid) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-
     while (retries) {
         ssize_t func_ret, bytes;
         int isdead = 0;
@@ -1473,7 +1465,7 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
         /* Filter out debug messages from intermediate libvirt process */
         while ((eol = strchr(filter_next, '\n'))) {
             *eol = '\0';
-            if (strstr(filter_next, debug)) {
+            if (virLogProbablyLogMessage(filter_next)) {
                 memmove(filter_next, eol + 1, got - (eol - buf));
                 got -= eol + 1 - filter_next;
             } else {
@@ -1510,7 +1502,6 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
                    what, buf);
 
 cleanup:
-    VIR_FREE(debug);
     return ret;
 }
 
@@ -3764,6 +3755,7 @@ int qemuProcessStart(virConnectPtr conn,
 
     if (unlink(priv->pidfile) < 0 &&
         errno != ENOENT) {
+        VIR_FREE(priv->pidfile);
         virReportSystemError(errno,
                              _("Cannot remove stale PID file %s"),
                              priv->pidfile);
-- 
1.7.11.7


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