+Tue 9 Dez 2008 21:08:43 CET Guido Günther <agx@sigxcpu.org>
+
+ logrotate qemu monitor logs
+ * src/qemu_driver.c: open logfile O_APPEND instead of O_TRUNC when
+ running as root
+ * qemud/Makefile.am: install logrotate configuration (by Harald Sraub)
+ and create logdir
+
Mon Dec 8 13:22:06 +0100 2008 Jim Meyering <meyering@redhat.com>
virsh.c: tweak options to produce more accurate help
default_xml_dest = libvirt/qemu/networks/default.xml
-install-data-local: install-init install-data-sasl install-data-polkit
+install-data-local: install-init install-data-sasl install-data-polkit \
+ install-logrotate
mkdir -p $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart
$(INSTALL_DATA) $(srcdir)/default-network.xml \
$(DESTDIR)$(sysconfdir)/$(default_xml_dest)
perl -w $(srcdir)/remote_generate_stubs.pl -r $(srcdir)/remote_protocol.x > $@
+libvirtd.logrotate: libvirtd.logrotate.in
+ sed \
+ -e s!\@localstatedir\@!@localstatedir@!g \
+ < $< > $@-t
+ mv $@-t $@
+
+install-logrotate: libvirtd.logrotate
+ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/
+ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
+ $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
+
if LIBVIRT_INIT_SCRIPTS_RED_HAT
install-init: libvirtd.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
--- /dev/null
+@localstatedir@/log/libvirt/qemu/*.log {
+ daily
+ missingok
+ rotate 7
+ compress
+ delaycompress
+ copytruncate
+}
unsigned int qemuCmdFlags;
fd_set keepfd;
const char *emulator;
+ uid_t uid = geteuid();
+ mode_t logmode;
FD_ZERO(&keepfd);
return -1;
}
- if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
- S_IRUSR | S_IWUSR)) < 0) {
+ logmode = O_CREAT | O_WRONLY;
+ if (uid != 0)
+ logmode |= O_TRUNC;
+ else
+ logmode |= O_APPEND;
+ if ((vm->logfile = open(logfile, logmode, S_IRUSR | S_IWUSR)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to create logfile %s: %s"),
logfile, strerror(errno));