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 <quintela@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
This commit is contained in:
Juan Quintela 2017-04-18 18:12:35 +02:00
parent 2bf3aa85f0
commit 927d663819
5 changed files with 43 additions and 33 deletions

9
hmp.c
View file

@ -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)