aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-04-01 13:12:40 +0100
committerPeter Maydell <peter.maydell@linaro.org>2024-04-01 13:12:40 +0100
commit6af9d12c88b9720f209912f6e4b01fefe5906d59 (patch)
treecc24b9b096a6ce2037edfc7dff443120f13c807a
parent1d2f2b35bc86b7a13dc3009a3c5031220aa0b7de (diff)
parentd0ad271a7613459bd0a3397c8071a4ad06f3f7eb (diff)
downloadqemu-6af9d12c88b9720f209912f6e4b01fefe5906d59.zip
qemu-6af9d12c88b9720f209912f6e4b01fefe5906d59.tar.gz
qemu-6af9d12c88b9720f209912f6e4b01fefe5906d59.tar.bz2
Merge tag 'migration-20240331-pull-request' of https://gitlab.com/peterx/qemu into staging
Migration pull for 9.0-rc2 - Avihai's two fixes on error paths # -----BEGIN PGP SIGNATURE----- # # iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCZgmsOxIccGV0ZXJ4QHJl # ZGhhdC5jb20ACgkQO1/MzfOr1waYKQD9G/B4c5u94Puhkr4o+K4M3FZ3J1pSpYRd # nMAlrCWYLHQBAKV5q8DvgXbRNzT/Q+1UX7psxIsjyaqljxyJoZ+dIgAD # =hucV # -----END PGP SIGNATURE----- # gpg: Signature made Sun 31 Mar 2024 19:32:27 BST # gpg: using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706 # gpg: issuer "peterx@redhat.com" # gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [marginal] # gpg: aka "Peter Xu <peterx@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D D1A9 3B5F CCCD F3AB D706 * tag 'migration-20240331-pull-request' of https://gitlab.com/peterx/qemu: migration/postcopy: Ensure postcopy_start() sets errp if it fails migration: Set migration error in migration_completion() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--migration/migration.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 9fe8fd2..86bf76e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2510,6 +2510,8 @@ static int postcopy_start(MigrationState *ms, Error **errp)
migration_wait_main_channel(ms);
if (postcopy_preempt_establish_channel(ms)) {
migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAILED);
+ error_setg(errp, "%s: Failed to establish preempt channel",
+ __func__);
return -1;
}
}
@@ -2525,17 +2527,22 @@ static int postcopy_start(MigrationState *ms, Error **errp)
ret = migration_stop_vm(ms, RUN_STATE_FINISH_MIGRATE);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "%s: Failed to stop the VM", __func__);
goto fail;
}
ret = migration_maybe_pause(ms, &cur_state,
MIGRATION_STATUS_POSTCOPY_ACTIVE);
if (ret < 0) {
+ error_setg_errno(errp, -ret, "%s: Failed in migration_maybe_pause()",
+ __func__);
goto fail;
}
ret = bdrv_inactivate_all();
if (ret < 0) {
+ error_setg_errno(errp, -ret, "%s: Failed in bdrv_inactivate_all()",
+ __func__);
goto fail;
}
restart_block = true;
@@ -2612,6 +2619,7 @@ static int postcopy_start(MigrationState *ms, Error **errp)
/* Now send that blob */
if (qemu_savevm_send_packaged(ms->to_dst_file, bioc->data, bioc->usage)) {
+ error_setg(errp, "%s: Failed to send packaged data", __func__);
goto fail_closefb;
}
qemu_fclose(fb);
@@ -2799,6 +2807,7 @@ static void migration_completion(MigrationState *s)
{
int ret = 0;
int current_active_state = s->state;
+ Error *local_err = NULL;
if (s->state == MIGRATION_STATUS_ACTIVE) {
ret = migration_completion_precopy(s, &current_active_state);
@@ -2832,6 +2841,15 @@ static void migration_completion(MigrationState *s)
return;
fail:
+ if (qemu_file_get_error_obj(s->to_dst_file, &local_err)) {
+ migrate_set_error(s, local_err);
+ error_free(local_err);
+ } else if (ret) {
+ error_setg_errno(&local_err, -ret, "Error in migration completion");
+ migrate_set_error(s, local_err);
+ error_free(local_err);
+ }
+
migration_completion_failed(s, current_active_state);
}