migration: Pass Error ** argument to {save, load}_vmstate
PATCH v2 1/1 migration: Pass Error ** argument to {save, load}_vmstate
This way we use the "normal" way of printing errors for hmp commands.
Signed-off-by Juan Quintela <[email protected]>
Suggested-by Paolo Bonzini <[email protected]>
---
Add err_report_err() in replay-snapshot.c to really print the error messages (dave suggestion)
--- hmp.c | 9 +++++++-- include/sysemu/sysemu.h | 4 ++-- migration/savevm.c | 51 ++++++++++++++++++++++++------------------------ replay/replay-snapshot.c | 8 ++++++-- vl.c | 4 +++- 5 files changed, 43 insertions(+), 33 deletions(-)
hmp.c +7 -2
@@ -1274,17 +1274,22 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) {int saved_vm_running =runstate_is_running ();const char *name =qdict_get_str (qdict,"name" ); +Error *err =NULL ;vm_stop (RUN_STATE_RESTORE_VM ); -if (load_vmstate (name) ==0 && saved_vm_running) { +if (load_vmstate (name, &err) ==0 && saved_vm_running) {vm_start (); } +hmp_handle_error (mon, &err); }void hmp_savevm (Monitor *mon,const QDict *qdict) { -save_vmstate (qdict_get_try_str (qdict,"name" )); +Error *err =NULL ; + +save_vmstate (qdict_get_try_str (qdict,"name" ), &err); +hmp_handle_error (mon, &err); }void hmp_delvm (Monitor *mon,const QDict *qdict)
include/sysemu/sysemu.h +2 -2
@@ -75,8 +75,8 @@ 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 (const char *name); -int load_vmstate (const char *name); +int save_vmstate (const char *name,Error **errp); +int load_vmstate (const char *name,Error **errp);void qemu_announce_self (void );
migration/savevm.c +25 -26
145 lines not on this page · raw message
replay/replay-snapshot.c +6 -2
@@ -62,14 +62,18 @@ void replay_vmstate_register(void)void replay_vmstate_init (void ) { +Error *err =NULL ; +if (replay_snapshot) {if (replay_mode ==REPLAY_MODE_RECORD ) { -if (save_vmstate (replay_snapshot) !=0 ) { +if (save_vmstate (replay_snapshot, &err) !=0 ) { +error_report_err (err);error_report ("Could not create snapshot for icount record" );exit (1 ); } }else if (replay_mode ==REPLAY_MODE_PLAY ) { -if (load_vmstate (replay_snapshot) !=0 ) { +if (load_vmstate (replay_snapshot, &err) !=0 ) { +error_report_err (err);error_report ("Could not load snapshot for icount replay" );exit (1 ); }
vl.c +3 -1
@@ -4686,7 +4686,9 @@ int main(int argc, char **argv, char **envp)if (replay_mode !=REPLAY_MODE_NONE ) {replay_vmstate_init (); }else if (loadvm) { -if (load_vmstate (loadvm) <0 ) { +Error *local_err =NULL ; +if (load_vmstate (loadvm, &local_err) <0 ) { +error_report_err (local_err); autostart =0 ; } }
Signature · 1 line
2.9.3
Quoted 12 lines · Juan Quintela
This way we use the "normal" way of printing errors for hmp commands.
Signed-off-by Juan Quintela <[email protected]>Suggested-by Paolo Bonzini <[email protected]>---
Add
err_report_err()inreplay-snapshot.cto really print the error messages (dave suggestion)
Quoted 8 lines
--- hmp.c | 9 +++++++-- include/sysemu/sysemu.h | 4 ++-- migration/savevm.c | 51 ++++++++++++++++++++++++------------------------ replay/replay-snapshot.c | 8 ++++++-- vl.c | 4 +++- 5 files changed, 43 insertions(+), 33 deletions(-)
Reviewed-by Laurent Vivier <[email protected]>
Quoted 4 lines · Juan Quintela
This way we use the "normal" way of printing errors for hmp commands.
Signed-off-by Juan Quintela <[email protected]>Suggested-by Paolo Bonzini <[email protected]>
Reviewed-by Peter Xu <[email protected]>
Signature · 1 line
Peter Xu