migration: push Error **errp into loadvm_postcopy_handle_listen()
This is an incremental step in converting vmstate loading code to report error via Error objects instead of directly printing it to console/monitor. It is ensured that loadvm_postcopy_handle_listen() must report an error in errp, in case of failure. Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Arun Menon <armenon@redhat.com> Tested-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-16-36f11a6fb9d3@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
34a94fe28d
commit
208e522766
1 changed files with 7 additions and 10 deletions
|
|
@ -2181,15 +2181,16 @@ static void *postcopy_ram_listen_thread(void *opaque)
|
|||
}
|
||||
|
||||
/* After this message we must be able to immediately receive postcopy data */
|
||||
static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis)
|
||||
static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis,
|
||||
Error **errp)
|
||||
{
|
||||
PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_LISTENING);
|
||||
Error *local_err = NULL;
|
||||
|
||||
trace_loadvm_postcopy_handle_listen("enter");
|
||||
|
||||
if (ps != POSTCOPY_INCOMING_ADVISE && ps != POSTCOPY_INCOMING_DISCARD) {
|
||||
error_report("CMD_POSTCOPY_LISTEN in wrong postcopy state (%d)", ps);
|
||||
error_setg(errp,
|
||||
"CMD_POSTCOPY_LISTEN in wrong postcopy state (%d)", ps);
|
||||
return -1;
|
||||
}
|
||||
if (ps == POSTCOPY_INCOMING_ADVISE) {
|
||||
|
|
@ -2212,14 +2213,14 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis)
|
|||
if (migrate_postcopy_ram()) {
|
||||
if (postcopy_ram_incoming_setup(mis)) {
|
||||
postcopy_ram_incoming_cleanup(mis);
|
||||
error_setg(errp, "Failed to setup incoming postcopy RAM blocks");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
trace_loadvm_postcopy_handle_listen("after uffd");
|
||||
|
||||
if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_LISTEN, &local_err)) {
|
||||
error_report_err(local_err);
|
||||
if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_LISTEN, errp)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2622,11 +2623,7 @@ static int loadvm_process_command(QEMUFile *f, Error **errp)
|
|||
return loadvm_postcopy_handle_advise(mis, len, errp);
|
||||
|
||||
case MIG_CMD_POSTCOPY_LISTEN:
|
||||
ret = loadvm_postcopy_handle_listen(mis);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to load device state command: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
return loadvm_postcopy_handle_listen(mis, errp);
|
||||
|
||||
case MIG_CMD_POSTCOPY_RUN:
|
||||
ret = loadvm_postcopy_handle_run(mis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue