[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qmp/hmp: add writeconfig
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qmp/hmp: add writeconfig |
Date: |
Thu, 16 Feb 2017 10:12:18 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
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 <address@hidden>
> ---
> +++ 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
signature.asc
Description: OpenPGP digital signature