From: Arun Menon Date: Thu, 18 Sep 2025 15:23:39 +0000 (+0530) Subject: migration: push Error **errp into loadvm_postcopy_handle_switchover_start() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa77746602cdf7e29d588d100e27f34bd6e46226;p=thirdparty%2Fqemu.git migration: push Error **errp into loadvm_postcopy_handle_switchover_start() 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_switchover_start() must report an error in errp, in case of failure. Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé Signed-off-by: Arun Menon Tested-by: Fabiano Rosas Reviewed-by: Akihiko Odaki Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-22-36f11a6fb9d3@redhat.com Signed-off-by: Peter Xu --- diff --git a/migration/savevm.c b/migration/savevm.c index 8937496d9f6..34b7a28d38d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2534,7 +2534,7 @@ static int loadvm_process_enable_colo(MigrationIncomingState *mis, return ret; } -static int loadvm_postcopy_handle_switchover_start(void) +static int loadvm_postcopy_handle_switchover_start(Error **errp) { SaveStateEntry *se; @@ -2547,6 +2547,7 @@ static int loadvm_postcopy_handle_switchover_start(void) ret = se->ops->switchover_start(se->opaque); if (ret < 0) { + error_setg(errp, "Switchover start failed: %d", ret); return ret; } } @@ -2655,11 +2656,7 @@ static int loadvm_process_command(QEMUFile *f, Error **errp) return loadvm_process_enable_colo(mis, errp); case MIG_CMD_SWITCHOVER_START: - ret = loadvm_postcopy_handle_switchover_start(); - if (ret < 0) { - error_setg(errp, "Failed to load device state command: %d", ret); - } - return ret; + return loadvm_postcopy_handle_switchover_start(errp); } return 0;