From: Paolo Bonzini <pbonzini@redhat.com>
To: Juan Quintela <quintela@redhat.com>, qemu-devel@nongnu.org
Cc: dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
Date: Tue, 18 Apr 2017 11:46:33 +0200 [thread overview]
Message-ID: <7aedc2da-c0de-a99a-eb8d-16fbe9cba8f3@redhat.com> (raw)
In-Reply-To: <c7f9792c-1e78-b7b9-c5cc-04b650b82820@redhat.com>
On 18/04/2017 11:44, Paolo Bonzini wrote:
>
>
> On 17/04/2017 22:00, Juan Quintela wrote:
>> load_vmstate() already use error_report, so be consistent.
>
> Better: make both return Error* via an Error** parameter, and add
>
> hmp_handle_error(mon, &err);
>
> to hmp_savevm and error_report_err(err) on the loading side.
Not really, loadvm is also a monitor command (I was confusing it with
-incoming). So it can use hmp_handle_error too.
Paolo
> Paolo
>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>> include/sysemu/sysemu.h | 2 +-
>> migration/savevm.c | 16 ++++++++--------
>> monitor.c | 2 +-
>> replay/replay-snapshot.c | 2 +-
>> 4 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index 146a0dc..d2582fa 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -75,7 +75,7 @@ void qemu_remove_exit_notifier(Notifier *notify);
>> void qemu_add_machine_init_done_notifier(Notifier *notify);
>> void qemu_remove_machine_init_done_notifier(Notifier *notify);
>>
>> -int save_vmstate(Monitor *mon, const char *name);
>> +int save_vmstate(const char *name);
>> int load_vmstate(const char *name);
>> void hmp_delvm(Monitor *mon, const QDict *qdict);
>> void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index cbd7e0d..36a6002 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -2055,7 +2055,7 @@ int qemu_loadvm_state(QEMUFile *f)
>> return ret;
>> }
>>
>> -int save_vmstate(Monitor *mon, const char *name)
>> +int save_vmstate(const char *name)
>> {
>> BlockDriverState *bs, *bs1;
>> QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
>> @@ -2069,8 +2069,8 @@ int save_vmstate(Monitor *mon, const char *name)
>> AioContext *aio_context;
>>
>> if (!bdrv_all_can_snapshot(&bs)) {
>> - monitor_printf(mon, "Device '%s' is writable but does not "
>> - "support snapshots.\n", bdrv_get_device_name(bs));
>> + error_report("Device '%s' is writable but does not support snapshots.",
>> + bdrv_get_device_name(bs));
>> return ret;
>> }
>>
>> @@ -2087,7 +2087,7 @@ int save_vmstate(Monitor *mon, const char *name)
>>
>> bs = bdrv_all_find_vmstate_bs();
>> if (bs == NULL) {
>> - monitor_printf(mon, "No block device can accept snapshots\n");
>> + error_report("No block device can accept snapshots");
>> return ret;
>> }
>> aio_context = bdrv_get_aio_context(bs);
>> @@ -2096,7 +2096,7 @@ int save_vmstate(Monitor *mon, const char *name)
>>
>> ret = global_state_store();
>> if (ret) {
>> - monitor_printf(mon, "Error saving global state\n");
>> + error_report("Error saving global state");
>> return ret;
>> }
>> vm_stop(RUN_STATE_SAVE_VM);
>> @@ -2128,7 +2128,7 @@ int save_vmstate(Monitor *mon, const char *name)
>> /* save the VM state */
>> f = qemu_fopen_bdrv(bs, 1);
>> if (!f) {
>> - monitor_printf(mon, "Could not open VM state file\n");
>> + error_report("Could not open VM state file");
>> goto the_end;
>> }
>> ret = qemu_savevm_state(f, &local_err);
>> @@ -2141,8 +2141,8 @@ int save_vmstate(Monitor *mon, const char *name)
>>
>> ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
>> if (ret < 0) {
>> - monitor_printf(mon, "Error while creating snapshot on '%s'\n",
>> - bdrv_get_device_name(bs));
>> + error_report("Error while creating snapshot on '%s'",
>> + bdrv_get_device_name(bs));
>> goto the_end;
>> }
>>
>> diff --git a/monitor.c b/monitor.c
>> index 2fca4fb..9e79a97 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1856,7 +1856,7 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
>>
>> static void hmp_savevm(Monitor *mon, const QDict *qdict)
>> {
>> - save_vmstate(mon, qdict_get_try_str(qdict, "name"));
>> + save_vmstate(qdict_get_try_str(qdict, "name"));
>> }
>>
>> int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>> diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
>> index 65e2d37..8cced46 100644
>> --- a/replay/replay-snapshot.c
>> +++ b/replay/replay-snapshot.c
>> @@ -64,7 +64,7 @@ void replay_vmstate_init(void)
>> {
>> if (replay_snapshot) {
>> if (replay_mode == REPLAY_MODE_RECORD) {
>> - if (save_vmstate(cur_mon, replay_snapshot) != 0) {
>> + if (save_vmstate(replay_snapshot) != 0) {
>> error_report("Could not create snapshot for icount record");
>> exit(1);
>> }
>>
>
next prev parent reply other threads:[~2017-04-18 9:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c Juan Quintela
2017-04-18 18:40 ` Dr. David Alan Gilbert
2017-04-19 7:02 ` Juan Quintela
2017-04-25 9:00 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 03/19] migration: Split migration/channel.c for channel operations Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 04/19] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file Juan Quintela
2017-04-18 9:45 ` Paolo Bonzini
2017-04-18 10:13 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 06/19] migration: Export fd.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 07/19] migration: Export socket.c " Juan Quintela
2017-04-19 15:37 ` Dr. David Alan Gilbert
2017-04-25 9:01 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 08/19] migration: Export tls.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable Juan Quintela
2017-04-17 20:26 ` Eric Blake
2017-04-18 6:35 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams Juan Quintela
2017-04-18 19:07 ` Dr. David Alan Gilbert
2017-04-19 7:17 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 11/19] migration: Remove " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 12/19] migration: Remove unneeded includes Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h Juan Quintela
2017-04-19 15:44 ` Dr. David Alan Gilbert
2017-04-17 20:00 ` [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h Juan Quintela
2017-04-19 17:16 ` Dr. David Alan Gilbert
2017-04-17 20:00 ` [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 16/19] migration: Export ram.c " Juan Quintela
2017-04-19 18:46 ` Dr. David Alan Gilbert
2017-04-25 9:39 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 17/19] migration: Export rdma.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c Juan Quintela
2017-04-18 9:44 ` Paolo Bonzini
2017-04-18 10:11 ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
2017-04-18 9:44 ` Paolo Bonzini
2017-04-18 9:46 ` Paolo Bonzini [this message]
2017-04-18 10:12 ` Juan Quintela
2017-04-19 7:19 ` Juan Quintela
2017-04-18 18:02 ` Dr. David Alan Gilbert
2017-04-18 20:06 ` Juan Quintela
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=7aedc2da-c0de-a99a-eb8d-16fbe9cba8f3@redhat.com \
--to=pbonzini@redhat.com \
--cc=dgilbert@redhat.com \
--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).