[libvirt] [PATCH] qemu: command: Truncate the chardev logging file even if append is not present

Peter Krempa posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/15b6928e1345f4241ec89c0cd227715ef299fcbf.1488388457.git.pkrempa@redhat.com
src/qemu/qemu_command.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[libvirt] [PATCH] qemu: command: Truncate the chardev logging file even if append is not present
Posted by Peter Krempa 7 years, 1 month ago
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 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 41eecfd18..46bd2e268 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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,
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: command: Truncate the chardev logging file even if append is not present
Posted by Jiri Denemark 7 years, 1 month ago
On Wed, Mar 01, 2017 at 18:15:05 +0100, Peter Krempa wrote:
> 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 present to behave

s/is/is not/

> 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 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 41eecfd18..46bd2e268 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -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,

ACK

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list