qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for 2.6 v2 1/1] qemu-char: append opt to stop truncation of serial file
@ 2015-12-03  6:34 Denis V. Lunev
  2015-12-03 15:26 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Denis V. Lunev @ 2015-12-03  6:34 UTC (permalink / raw)
  Cc: qemu-devel, Markus Armbruster, Olga Krishtal, Denis V. Lunev,
	Paolo Bonzini

From: Olga Krishtal <okrishtal@virtuozzo.com>

Our QA team wants to preserve serial output of the guest in between QEMU
runs to perform post-analysis.

By default this behavior is off (file is truncated each time QEMU is started
or device is plugged).

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
---
Changes from v1: s/parallels.com/virtuozzo.com/ :(

 qapi-schema.json |  7 ++++++-
 qemu-char.c      | 12 +++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index 8b1a423..802c138 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3020,11 +3020,16 @@
 #
 # @in:  #optional The name of the input file
 # @out: The name of the output file
+# @append: #optional Open the file in append mode to preserve the content in
+#          between QEMU runs.
+#
+#          Since: 2.6
 #
 # Since: 1.4
 ##
 { 'struct': 'ChardevFile', 'data': { '*in' : 'str',
-                                   'out' : 'str' } }
+                                   'out' : 'str',
+                                   '*append': 'bool' } }
 
 ##
 # @ChardevHostdev:
diff --git a/qemu-char.c b/qemu-char.c
index 5448b0f..58454e2 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3479,6 +3479,7 @@ static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend,
     }
     backend->u.file = g_new0(ChardevFile, 1);
     backend->u.file->out = g_strdup(path);
+    backend->u.file->append = qemu_opt_get_bool(opts, "append", false);
 }
 
 static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
@@ -4036,6 +4037,9 @@ QemuOptsList qemu_chardev_opts = {
         },{
             .name = "chardev",
             .type = QEMU_OPT_STRING,
+        },{
+            .name = "append",
+            .type = QEMU_OPT_BOOL,
         },
         { /* end of list */ }
     },
@@ -4096,7 +4100,13 @@ static CharDriverState *qmp_chardev_open_file(const char *id,
     ChardevFile *file = backend->u.file;
     int flags, in = -1, out;
 
-    flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY;
+    flags = O_WRONLY | O_CREAT | O_BINARY;
+    if (file->append) {
+        flags |= O_APPEND;
+    } else {
+        flags |= O_TRUNC;
+    }
+
     out = qmp_chardev_open_file_source(file->out, flags, errp);
     if (out < 0) {
         return NULL;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.6 v2 1/1] qemu-char: append opt to stop truncation of serial file
  2015-12-03  6:34 [Qemu-devel] [PATCH for 2.6 v2 1/1] qemu-char: append opt to stop truncation of serial file Denis V. Lunev
@ 2015-12-03 15:26 ` Eric Blake
  2015-12-03 15:32   ` Denis V. Lunev
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2015-12-03 15:26 UTC (permalink / raw)
  To: Denis V. Lunev
  Cc: Olga Krishtal, Paolo Bonzini, qemu-devel, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

On 12/02/2015 11:34 PM, Denis V. Lunev wrote:
> From: Olga Krishtal <okrishtal@virtuozzo.com>
> 
> Our QA team wants to preserve serial output of the guest in between QEMU
> runs to perform post-analysis.
> 
> By default this behavior is off (file is truncated each time QEMU is started
> or device is plugged).
> 
> Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Eric Blake <eblake@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> ---
> Changes from v1: s/parallels.com/virtuozzo.com/ :(

I reviewed v1 before I saw this, so those comments still apply here.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.6 v2 1/1] qemu-char: append opt to stop truncation of serial file
  2015-12-03 15:26 ` Eric Blake
@ 2015-12-03 15:32   ` Denis V. Lunev
  0 siblings, 0 replies; 3+ messages in thread
From: Denis V. Lunev @ 2015-12-03 15:32 UTC (permalink / raw)
  To: Eric Blake; +Cc: Olga Krishtal, Paolo Bonzini, qemu-devel, Markus Armbruster

On 12/03/2015 06:26 PM, Eric Blake wrote:
> On 12/02/2015 11:34 PM, Denis V. Lunev wrote:
>> From: Olga Krishtal <okrishtal@virtuozzo.com>
>>
>> Our QA team wants to preserve serial output of the guest in between QEMU
>> runs to perform post-analysis.
>>
>> By default this behavior is off (file is truncated each time QEMU is started
>> or device is plugged).
>>
>> Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Eric Blake <eblake@redhat.com>
>> CC: Markus Armbruster <armbru@redhat.com>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> Changes from v1: s/parallels.com/virtuozzo.com/ :(
> I reviewed v1 before I saw this, so those comments still apply here.
>
yep :) thank you. Comments are clear

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-03 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03  6:34 [Qemu-devel] [PATCH for 2.6 v2 1/1] qemu-char: append opt to stop truncation of serial file Denis V. Lunev
2015-12-03 15:26 ` Eric Blake
2015-12-03 15:32   ` Denis V. Lunev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).