|
@@ -72,6 +72,8 @@
|
|
|
#define NOTIFIER_ELEM_INIT(array, elem) \
|
|
|
[elem] = NOTIFIER_WITH_RETURN_LIST_INITIALIZER((array)[elem])
|
|
|
|
|
|
+#define INMIGRATE_DEFAULT_EXIT_ON_ERROR true
|
|
|
+
|
|
|
static NotifierWithReturnList migration_state_notifiers[] = {
|
|
|
NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_NORMAL),
|
|
|
NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_CPR_REBOOT),
|
|
@@ -234,6 +236,8 @@ void migration_object_init(void)
|
|
|
qemu_cond_init(¤t_incoming->page_request_cond);
|
|
|
current_incoming->page_requested = g_tree_new(page_request_addr_cmp);
|
|
|
|
|
|
+ current_incoming->exit_on_error = INMIGRATE_DEFAULT_EXIT_ON_ERROR;
|
|
|
+
|
|
|
migration_object_check(current_migration, &error_fatal);
|
|
|
|
|
|
blk_mig_init();
|
|
@@ -800,12 +804,14 @@ fail:
|
|
|
|
|
|
migration_incoming_state_destroy();
|
|
|
|
|
|
- WITH_QEMU_LOCK_GUARD(&s->error_mutex) {
|
|
|
- error_report_err(s->error);
|
|
|
- s->error = NULL;
|
|
|
- }
|
|
|
+ if (mis->exit_on_error) {
|
|
|
+ WITH_QEMU_LOCK_GUARD(&s->error_mutex) {
|
|
|
+ error_report_err(s->error);
|
|
|
+ s->error = NULL;
|
|
|
+ }
|
|
|
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1314,6 +1320,15 @@ static void fill_destination_migration_info(MigrationInfo *info)
|
|
|
break;
|
|
|
}
|
|
|
info->status = mis->state;
|
|
|
+
|
|
|
+ if (!info->error_desc) {
|
|
|
+ MigrationState *s = migrate_get_current();
|
|
|
+ QEMU_LOCK_GUARD(&s->error_mutex);
|
|
|
+
|
|
|
+ if (s->error) {
|
|
|
+ info->error_desc = g_strdup(error_get_pretty(s->error));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
MigrationInfo *qmp_query_migrate(Error **errp)
|
|
@@ -1797,10 +1812,13 @@ void migrate_del_blocker(Error **reasonp)
|
|
|
}
|
|
|
|
|
|
void qmp_migrate_incoming(const char *uri, bool has_channels,
|
|
|
- MigrationChannelList *channels, Error **errp)
|
|
|
+ MigrationChannelList *channels,
|
|
|
+ bool has_exit_on_error, bool exit_on_error,
|
|
|
+ Error **errp)
|
|
|
{
|
|
|
Error *local_err = NULL;
|
|
|
static bool once = true;
|
|
|
+ MigrationIncomingState *mis = migration_incoming_get_current();
|
|
|
|
|
|
if (!once) {
|
|
|
error_setg(errp, "The incoming migration has already been started");
|
|
@@ -1815,6 +1833,9 @@ void qmp_migrate_incoming(const char *uri, bool has_channels,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ mis->exit_on_error =
|
|
|
+ has_exit_on_error ? exit_on_error : INMIGRATE_DEFAULT_EXIT_ON_ERROR;
|
|
|
+
|
|
|
qemu_start_incoming_migration(uri, has_channels, channels, &local_err);
|
|
|
|
|
|
if (local_err) {
|