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/savevm.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/migration/savevm.c b/migration/savevm.c > index fa7883ae5e..2216c61c6f 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -1735,7 +1735,8 @@ static int > loadvm_postcopy_handle_advise(MigrationIncomingState *mis, > * There can be 0..many of these messages, each encoding multiple pages. > */ > static int loadvm_postcopy_ram_handle_discard(MigrationIncomingState *mis, > - uint16_t len) > + uint16_t len, > + Error **errp) > { > int tmp; > char ramid[256]; > @@ -1748,7 +1749,8 @@ static int > loadvm_postcopy_ram_handle_discard(MigrationIncomingState *mis, > /* 1st discard */ > tmp = postcopy_ram_prepare_discard(mis); > if (tmp) { > - return tmp; > + error_setg(errp, "Failed to prepare for RAM discard: %d", tmp);
New error, OK. Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com> > + return -1; > }