qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Eduardo Otubo <eduardo.otubo@profitbricks.com>, qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] qmp/hmp: add writeconfig
Date: Thu, 16 Feb 2017 10:12:18 -0600	[thread overview]
Message-ID: <39c05fd9-af3c-5ef7-72c0-f8d9492fda56@redhat.com> (raw)
In-Reply-To: <20170215101427.23736-2-eduardo.otubo@profitbricks.com>

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

On 02/15/2017 04:14 AM, Eduardo Otubo wrote:
> This patch adds support for the command `writeconfig' on the QMP and HMP
> consoles. This is a simple way to keep track of current state of VM
> after series of hotplugs and/or hotunplugs of different devices:
> 
>   (qemu) writeconfig qemu.conf
> 
> Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
> ---

> +++ b/qapi-schema.json
> @@ -4696,6 +4696,26 @@
>    'data': { 'keys': ['KeyValue'], '*hold-time': 'int' } }
>  
>  ##
> +# @writeconfig:
> +#
> +# Write config to file.
> +#
> +# @filename: the path of a new file to store the current config
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 2.7.0
> +#

You've missed 2.7 by two releases.  This should be 2.9.


> +++ b/ui/console.c

>  
> +void qmp_writeconfig(const char *filename, Error **errp)
> +{
> +    if (filename == NULL) {
> +        error_setg(errp, "You must specify a filename.");
> +        return;
> +    }

Dead code; QAPI ensures that filename is non-NULL.
Even if it weren't dead code, error_setg() messages should not end in '.'.

> +
> +    FILE *fp;
> +    fp = fopen(filename, "w");

Please use qemu_fopen() - that way, the caller can also use qemu's magic
/dev/fdset to write to a pre-opened fd even when qemu itself can't
open() the file.

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

  reply	other threads:[~2017-02-16 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 10:14 [Qemu-devel] [PATCH 0/2] add writeconfig command on monitor Eduardo Otubo
2017-02-15 10:14 ` [Qemu-devel] [PATCH 1/2] qmp/hmp: add writeconfig Eduardo Otubo
2017-02-16 16:12   ` Eric Blake [this message]
2017-02-15 10:14 ` [Qemu-devel] [PATCH 2/2] object_add not registering option Eduardo Otubo
2017-02-16  9:23 ` [Qemu-devel] [PATCH 0/2] add writeconfig command on monitor Markus Armbruster
2017-02-16  9:53   ` Dr. David Alan Gilbert
2017-02-16 10:31     ` Eduardo Otubo

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=39c05fd9-af3c-5ef7-72c0-f8d9492fda56@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eduardo.otubo@profitbricks.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).