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 5/5] qmp: create QMP implementation of loadvm command
Date: Wed, 23 Dec 2015 16:15:34 -0700 [thread overview]
Message-ID: <567B2B16.7060705@redhat.com> (raw)
In-Reply-To: <1449240275-26196-6-git-send-email-den@openvz.org>
[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]
On 12/04/2015 07:44 AM, Denis V. Lunev wrote:
> Unfortunately load_vmstate has a return code (int) and this code is checked
> in the other places. Thus we could not just rename it to qmp_loadvm as
> returns void.
>
> 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>
> ---
> migration/savevm.c | 12 ++++++++++++
> monitor.c | 12 ++++++------
> qapi-schema.json | 13 +++++++++++++
> qmp-commands.hx | 23 +++++++++++++++++++++++
> 4 files changed, 54 insertions(+), 6 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 7846437..07b0bf4 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2103,6 +2103,18 @@ int load_vmstate(const char *name, Error **errp)
> return 0;
> }
>
> +void qmp_loadvm(const char *name, Error **errp)
> +{
> + int saved_vm_running = runstate_is_running();
> + vm_stop(RUN_STATE_RESTORE_VM);
> +
> + load_vmstate(name, errp);
> +
> + if (saved_vm_running) {
> + vm_start();
Do you really mean to be calling vm_start() even if an error was
reported? But to properly short-circuit, you need a local 'Error *err =
NULL; load_vmstate(name, &err);', rather than reusing errp (since the
caller may pass in NULL).
> +++ b/monitor.c
> @@ -1737,18 +1737,18 @@ void qmp_closefd(const char *fdname, Error **errp)
>
> static void hmp_loadvm(Monitor *mon, const QDict *qdict)
> {
> - int saved_vm_running = runstate_is_running();
> const char *name = qdict_get_str(qdict, "name");
> Error *local_err = NULL;
>
> - vm_stop(RUN_STATE_RESTORE_VM);
> + if (name == NULL) {
Dead code. qdict_get_str() crashes rather than returning NULL, if
"name" is not present.
> +++ b/qmp-commands.hx
> @@ -4787,3 +4787,26 @@ EQMP
> .args_type = "name:s",
> .mhandler.cmd_new = qmp_marshal_delvm,
> },
> +
> +SQMP
> +loadvm
> +------------------
Line too long.
--
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 23:15 UTC|newest]
Thread overview: 26+ 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
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 [this message]
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 5/5] qmp: create QMP implementation of loadvm 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 5/5] qmp: create QMP implementation of loadvm 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 5/5] qmp: create QMP implementation of loadvm command Denis V. Lunev
2015-11-18 11:41 ` Juan Quintela
2015-12-01 15:19 ` 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=567B2B16.7060705@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.