{
MigrationStatus current = s->state;
MigrationStatus next = MIGRATION_STATUS_NONE;
+ bool resume = false;
switch (current) {
case MIGRATION_STATUS_SETUP:
next = MIGRATION_STATUS_FAILED;
break;
+ case MIGRATION_STATUS_POSTCOPY_PAUSED:
+ resume = true;
+ break;
+
case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
/* Never fail a postcopy migration; switch back to PAUSED instead */
next = MIGRATION_STATUS_POSTCOPY_PAUSED;
+ resume = true;
break;
case MIGRATION_STATUS_CANCELLING:
}
migrate_error_propagate(s, error);
+
+ if (!resume) {
+ migration_cleanup(s);
+ }
}
void migration_cancel(void)
MigrationAddress *addr = opaque;
qmp_migrate_finish(addr, NULL);
-
- cpr_state_close();
- migrate_hup_delete(migrate_get_current());
qapi_free_MigrationAddress(addr);
return G_SOURCE_REMOVE;
}
MigrationChannelList *channels,
bool has_resume, bool resume, Error **errp)
{
- Error *local_err = NULL;
MigrationState *s = migrate_get_current();
g_autoptr(MigrationChannel) channel = NULL;
MigrationAddress *addr = NULL;
return;
}
+ /*
+ * The migrate_prepare() above calls migrate_init(). From this
+ * point on, until the end of migration, make sure any failures
+ * eventually result in a call to migration_cleanup().
+ */
+ Error *local_err = NULL;
+
if (!cpr_state_save(cpr_channel, &local_err)) {
goto out;
}
out:
if (local_err) {
- yank_unregister_instance(MIGRATION_YANK_INSTANCE);
migration_connect_error_propagate(s, error_copy(local_err));
error_propagate(errp, local_err);
}
s->expected_downtime = migrate_downtime_limit();
if (error_in) {
migration_connect_error_propagate(s, error_in);
- if (!resume) {
- migration_cleanup(s);
- }
if (s->error) {
error_report_err(error_copy(s->error));
}
fail:
migration_connect_error_propagate(s, local_err);
- migration_cleanup(s);
if (s->error) {
error_report_err(error_copy(s->error));
}