On 2/4/21 6:18 PM, Daniel P. Berrangé wrote: > This is an incremental step in converting vmstate loading code to report > via Error objects instead of printing directly to the console/monitor. > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > --- > migration/migration.c | 4 ++-- > migration/savevm.c | 36 ++++++++++++++++++++---------------- > migration/savevm.h | 2 +- > 3 files changed, 23 insertions(+), 19 deletions(-) ...
> diff --git a/migration/savevm.c b/migration/savevm.c > index 6b320423c7..c8d93eee1e 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -2638,40 +2638,49 @@ out: > return ret; > } > > -int qemu_loadvm_state(QEMUFile *f) > +int qemu_loadvm_state(QEMUFile *f, Error **errp) > { > MigrationIncomingState *mis = migration_incoming_get_current(); > - Error *local_err = NULL; > int ret; > > - if (qemu_savevm_state_blocked(&local_err)) { > - error_report_err(local_err); > - return -EINVAL; > + if (qemu_savevm_state_blocked(errp)) { > + return -1; > } > > ret = qemu_loadvm_state_header(f); > if (ret) { > - return ret; > + error_setg(errp, "Error %d while loading VM state", ret); Using error_setg_errno() instead (multiple occurences): Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com> > + return -1; > } >