qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: Olga Krishtal <okrishtal@parallels.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for 2.6 1/1] qemu-char: append opt to stop truncation of serial file
Date: Thu, 3 Dec 2015 08:25:14 -0700	[thread overview]
Message-ID: <56605EDA.80705@redhat.com> (raw)
In-Reply-To: <1449123852-9260-1-git-send-email-den@openvz.org>

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

On 12/02/2015 11:24 PM, Denis V. Lunev wrote:
> From: Olga Krishtal <okrishtal@parallels.com>
> 
> Our QA teams 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@parallels.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>
> ---
>  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

The 'Since' tag is wrong.  Also, the wording might sound better as:

# @append: #optional Open the file in append mode (default false to
           truncate) (Since 2.6)

>  #
>  # Since: 1.4

The way you wrote it makes it look like the since 2.6 and since 1.4 tags
both apply to the overall struct, which is not true.

>  ##
>  { '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);

You also need to set backend->u.file->has_append. (Because you are
always initializing it, with a default of false, you can set has_append
to true, rather than worrying about whether the user provided an
"append" option.)

-- 
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 --]

      parent reply	other threads:[~2015-12-03 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03  6:24 [Qemu-devel] [PATCH for 2.6 1/1] qemu-char: append opt to stop truncation of serial file Denis V. Lunev
2015-12-03  6:32 ` Denis V. Lunev
2015-12-03 15:25 ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56605EDA.80705@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=okrishtal@parallels.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).