Browse Source

migration: Move error reporting out of migration_cleanup

In the next patches migration_cleanup() will be used in qmp_migrate(),
which currently does not show an error message. Move the error
reporting out of migration_cleanup() to avoid duplicate messages.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-9-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
pull/316/head
Fabiano Rosas 7 months ago
parent
commit
f7be51a690
  1. 29
      migration/migration.c

29
migration/migration.c

@ -1527,10 +1527,6 @@ static void migration_cleanup(MigrationState *s)
MIGRATION_STATUS_CANCELLED);
}
if (s->error) {
/* It is used on info migrate. We can't free it */
error_report_err(error_copy(s->error));
}
type = migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED :
MIG_EVENT_PRECOPY_DONE;
migration_call_notifiers(type, NULL);
@ -1539,7 +1535,12 @@ static void migration_cleanup(MigrationState *s)
static void migration_cleanup_bh(void *opaque)
{
migration_cleanup(opaque);
MigrationState *s = opaque;
migration_cleanup(s);
if (s->error) {
error_report_err(error_copy(s->error));
}
}
/*
@ -4017,18 +4018,12 @@ void migration_connect(MigrationState *s, Error *error_in)
s->expected_downtime = migrate_downtime_limit();
if (error_in) {
migration_connect_error_propagate(s, error_in);
if (resume) {
/*
* Don't do cleanup for resume if channel is invalid, but only dump
* the error. We wait for another channel connect from the user.
* The error_report still gives HMP user a hint on what failed.
* It's normally done in migration_cleanup(), but call it here
* explicitly.
*/
error_report_err(error_copy(s->error));
} else {
if (!resume) {
migration_cleanup(s);
}
if (s->error) {
error_report_err(error_copy(s->error));
}
return;
}
@ -4107,8 +4102,10 @@ fail:
if (s->state != MIGRATION_STATUS_CANCELLING) {
migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED);
}
error_report_err(local_err);
migration_cleanup(s);
if (s->error) {
error_report_err(error_copy(s->error));
}
}
static void migration_class_init(ObjectClass *klass, const void *data)

Loading…
Cancel
Save