]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: command: Truncate the chardev logging file even if append is not present
authorPeter Krempa <pkrempa@redhat.com>
Wed, 1 Mar 2017 17:15:05 +0000 (18:15 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 2 Mar 2017 08:03:41 +0000 (09:03 +0100)
Our documentation states that the chardev logging file is truncated
unless append='on' is specified. QEMU also behaves the same way and
truncates the file unless we provide the argument. The new virlogd
implementation did not honor if the argument was missing and continued
to append to the file.

Truncate the file even when the 'append' attribute is not present to
behave the same with both implementations and adhere to the docs.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1420205

src/qemu/qemu_command.c

index 41eecfd18722ea44d1201613da7c52d8f4d8bf2c..46bd2e26824e43eec776e2c6049109b7d8f76787 100644 (file)
@@ -4827,7 +4827,8 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManager,
         int flags = 0;
         int logfd;
 
-        if (appendval == VIR_TRISTATE_SWITCH_OFF)
+        if (appendval == VIR_TRISTATE_SWITCH_ABSENT ||
+            appendval == VIR_TRISTATE_SWITCH_OFF)
             flags |= VIR_LOG_MANAGER_PROTOCOL_DOMAIN_OPEN_LOG_FILE_TRUNCATE;
 
         if ((logfd = virLogManagerDomainOpenLogFile(logManager,