From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: Amit Shah <amit.shah@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/5] qmp: create qmp_savevm command
Date: Wed, 23 Dec 2015 14:40:30 -0700 [thread overview]
Message-ID: <567B14CE.90508@redhat.com> (raw)
In-Reply-To: <1449240275-26196-3-git-send-email-den@openvz.org>
[-- Attachment #1: Type: text/plain, Size: 3998 bytes --]
On 12/04/2015 07:44 AM, Denis V. Lunev wrote:
> 'name' attribute is made mandatory in distinction with HMP command.
>
> The patch also moves hmp_savevm implementation into hmp.c. This function
> is just a simple wrapper now and does not have knowledge about
> migration internals.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Juan Quintela <quintela@redhat.com>
> CC: Amit Shah <amit.shah@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
> hmp.c | 12 ++++++++++++
> migration/savevm.c | 13 +------------
> qapi-schema.json | 13 +++++++++++++
> qmp-commands.hx | 25 +++++++++++++++++++++++++
> 4 files changed, 51 insertions(+), 12 deletions(-)
>
> diff --git a/hmp.c b/hmp.c
> index 2140605..c9c7100 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -32,6 +32,7 @@
> #include "ui/console.h"
> #include "block/qapi.h"
> #include "qemu-io.h"
> +#include "sysemu/sysemu.h"
What is this header needed for?
>
> #ifdef CONFIG_SPICE
> #include <spice/enums.h>
> @@ -2378,3 +2379,14 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict)
>
> qapi_free_RockerOfDpaGroupList(list);
> }
> +
> +void hmp_savevm(Monitor *mon, const QDict *qdict)
> +{
> + Error *local_err = NULL;
I've been favoring 'err' rather than 'local_err', but that's not a
show-stopper since we still have both spellings mixed in the tree.
> +
> + qmp_savevm(qdict_get_try_str(qdict, "name"), &local_err);
qdict_get_try_str() can return NULL;, but qmp_savevm() requires a
non-NULL string. You'll need to invent a name in HMP if the user didn't
give you one.
> +++ b/migration/savevm.c
> @@ -1905,7 +1905,7 @@ int qemu_loadvm_state(QEMUFile *f)
> return ret;
> }
>
> -static void do_savevm(const char *name, Error **errp)
> +void qmp_savevm(const char *name, Error **errp)
> {
This function still has some 'if (name)' conditionals; but according to
the qapi contract, name should never be NULL. You need to hoist the name
creation aspect to the caller (hmp_savevm), and in qmp_savevm you can
then assert(name).
> BlockDriverState *bs, *bs1;
> QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
> @@ -1999,17 +1999,6 @@ static void do_savevm(const char *name, Error **errp)
> }
> }
>
> -void hmp_savevm(Monitor *mon, const QDict *qdict)
> -{
> - Error *local_err = NULL;
> -
> - do_savevm(qdict_get_try_str(qdict, "name"), &local_err);
Hmm. You are doing code motion of code you just added in 1/5; wouldn't
it be better if 1/5 stuck it in the right file to begin with? And my
argument about needing the name logic in HMP (not QMP) means that maybe
the split in 1/5 isn't ideal, after all.
> +++ b/qapi-schema.json
> @@ -3971,3 +3971,16 @@
> ##
> { 'enum': 'ReplayMode',
> 'data': [ 'none', 'record', 'play' ] }
> +
> +##
> +# @savevm
> +#
> +# Save a VM snapshot. Without a name new snapshot is created",
Stale sentence, since a name is required.
> +#
> +# @name: identifier of a snapshot to be created
> +#
> +# Returns: Nothing on success
> +#
> +# Since 2.6
> +##
> +{ 'command': 'savevm', 'data': {'name': 'str'} }
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index 9d8b42f..f216c5e 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -4739,3 +4739,28 @@ Example:
> {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840,
> "pop-vlan": 1, "id": 251658240}
> ]}
> +
> +EQMP
> +
> +SQMP
> +savevm
> +------------------
Line too long. Make it match the length of the line above.
> +
> +Save a VM snapshot. If no tag or id are provided, a new snapshot is created
Stale sentence, since you are requiring a name.
Why does QMP not allow specifying an id? Should it?
--
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 --]
next prev parent reply other threads:[~2015-12-23 21:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 14:44 [Qemu-devel] [PATCH v2 for 2.6 0/5] QMP wrappers for VM snapshot operations Denis V. Lunev
2015-12-04 14:44 ` [Qemu-devel] [PATCH 1/5] migration: split hmp_savevm to do_savevm and hmp_savevm wrapper Denis V. Lunev
2015-12-23 21:27 ` Eric Blake
2016-01-08 11:27 ` Denis V. Lunev
2016-01-08 16:14 ` Eric Blake
2016-01-08 16:40 ` Denis V. Lunev
2016-01-08 17:54 ` Eric Blake
2016-01-08 17:59 ` Denis V. Lunev
2015-12-04 14:44 ` [Qemu-devel] [PATCH 2/5] qmp: create qmp_savevm command Denis V. Lunev
2015-12-23 21:40 ` Eric Blake [this message]
2015-12-23 21:45 ` Denis V. Lunev
2016-01-08 13:19 ` Denis V. Lunev
2015-12-04 14:44 ` [Qemu-devel] [PATCH 3/5] qmp: create qmp_delvm command Denis V. Lunev
2015-12-23 21:48 ` Eric Blake
2015-12-04 14:44 ` [Qemu-devel] [PATCH 4/5] migration: improve error reporting for load_vmstate Denis V. Lunev
2015-12-23 21:56 ` Eric Blake
2015-12-04 14:44 ` [Qemu-devel] [PATCH 5/5] qmp: create QMP implementation of loadvm command Denis V. Lunev
2015-12-23 23:15 ` Eric Blake
2015-12-11 9:33 ` [Qemu-devel] [PATCH v2 for 2.6 0/5] QMP wrappers for VM snapshot operations Denis V. Lunev
2015-12-18 6:10 ` Denis V. Lunev
2015-12-23 21:10 ` Denis V. Lunev
-- strict thread matches above, loose matches on Subject: below --
2016-01-08 14:10 [Qemu-devel] [PATCH v4 " Denis V. Lunev
2016-01-08 14:10 ` [Qemu-devel] [PATCH 2/5] qmp: create qmp_savevm command Denis V. Lunev
2016-01-08 14:00 [Qemu-devel] [PATCH v3 0/5] QMP wrappers for VM snapshot operations Denis V. Lunev
2016-01-08 14:00 ` [Qemu-devel] [PATCH 2/5] qmp: create qmp_savevm command Denis V. Lunev
2015-11-16 15:32 [Qemu-devel] [PATCH 0/5] QMP wrappers for VM snapshot operations Denis V. Lunev
2015-11-16 15:32 ` [Qemu-devel] [PATCH 2/5] qmp: create qmp_savevm command Denis V. Lunev
2015-11-17 10:10 ` Markus Armbruster
2015-11-18 11:36 ` Juan Quintela
2015-12-01 14:28 ` Denis V. Lunev
2015-12-01 15:01 ` Eric Blake
2015-12-01 15:03 ` Markus Armbruster
2015-12-01 14:29 ` Denis V. Lunev
2015-12-01 15:05 ` Markus Armbruster
2015-12-01 15:18 ` Denis V. Lunev
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=567B14CE.90508@redhat.com \
--to=eblake@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).