[libvirt] Open monitor logs O_APPEND

Guido Günther agx at sigxcpu.org
Thu Dec 4 13:11:07 UTC 2008


Hi,
attached patch is from Debian Bug #507553:

The logfile is opened with O_APPEND (to make logrotate work with
copytruncate) and without O_TRUNC (to not lose log information e.g. with
stop and start of a VM).

Using collectd or munin to monitor VMs creates quiet a bit of qemu
monitor output so the ability to use logrotate makes a lot of sense to
me.
O.k. to apply?
 -- Guido

diff -ur libvirt-0.4.4.orig/src/qemu_driver.c libvirt-0.4.4/src/qemu_driver.c
--- libvirt-0.4.4.orig/src/qemu_driver.c        2008-06-12
16:52:53.000000000 +0200
+++ libvirt-0.4.4/src/qemu_driver.c     2008-12-02 12:48:32.271881000 +0100
@@ -844,7 +844,7 @@
         return -1;
     }

-    if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
+    if ((vm->logfile = open(logfile, O_CREAT | O_APPEND | O_WRONLY,
                             S_IRUSR | S_IWUSR)) < 0) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          _("failed to create logfile %s: %s"),




More information about the libvir-list mailing list