Skip to content

Commit

Permalink
Merge tag 'migration-20240331-pull-request' of https://gitlab.com/pet…
Browse files Browse the repository at this point in the history
…erx/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>
  • Loading branch information
pm215 committed Apr 1, 2024
2 parents 1d2f2b3 + d0ad271 commit 6af9d12
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 6af9d12

Please sign in to comment.