[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from sa
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate |
Date: |
Tue, 18 Apr 2017 11:46:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
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 <address@hidden>
>> ---
>> 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);
>> }
>>
>
- [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file, (continued)
- [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file, Juan Quintela, 2017/04/17
- [Qemu-devel] [PATCH 16/19] migration: Export ram.c functions in its own file, Juan Quintela, 2017/04/17
- [Qemu-devel] [PATCH 17/19] migration: Export rdma.c functions in its own file, Juan Quintela, 2017/04/17
- [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c, Juan Quintela, 2017/04/17
- [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate, Juan Quintela, 2017/04/17
- Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate, Dr. David Alan Gilbert, 2017/04/18