diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f9f40a2b03..50e350b0c4 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2378,11 +2378,18 @@ qemuMigrationDstRun(virDomainObj *vm, const char *uri, virDomainAsyncJob asyncJob) { + virTristateBool exitOnError = VIR_TRISTATE_BOOL_ABSENT; qemuDomainObjPrivate *priv = vm->privateData; int rv; VIR_DEBUG("Setting up incoming migration with URI %s", uri); + /* Ask QEMU not to exit on failure during incoming migration (if supported) + * so that we can properly check and report error during Finish phase. + */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_INCOMING_EXIT_ON_ERROR)) + exitOnError = VIR_TRISTATE_BOOL_NO; + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; @@ -2390,7 +2397,7 @@ qemuMigrationDstRun(virDomainObj *vm, if (rv < 0) goto exit_monitor; - rv = qemuMonitorMigrateIncoming(priv->mon, uri); + rv = qemuMonitorMigrateIncoming(priv->mon, uri, exitOnError); exit_monitor: qemuDomainObjExitMonitor(vm); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index c198ddb625..ec2f166785 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3811,13 +3811,15 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, int qemuMonitorMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) { - VIR_DEBUG("uri=%s", uri); + VIR_DEBUG("uri=%s, exitOnError=%s", + uri, virTristateBoolTypeToString(exitOnError)); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONMigrateIncoming(mon, uri); + return qemuMonitorJSONMigrateIncoming(mon, uri, exitOnError); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index ac3a7b6db3..c74892c4dc 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1294,7 +1294,8 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, ATTRIBUTE_NONNULL(2); int qemuMonitorMigrateIncoming(qemuMonitor *mon, - const char *uri); + const char *uri, + virTristateBool exitOnError); int qemuMonitorMigrateStartPostCopy(qemuMonitor *mon); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6500e01d3f..9f417d27c6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7269,13 +7269,15 @@ qemuMonitorJSONFindLinkPath(qemuMonitor *mon, int qemuMonitorJSONMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) { g_autoptr(virJSONValue) cmd = NULL; g_autoptr(virJSONValue) reply = NULL; if (!(cmd = qemuMonitorJSONMakeCommand("migrate-incoming", "s:uri", uri, + "T:exit-on-error", exitOnError, NULL))) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 0214e9e9ff..2f5a021f56 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -607,7 +607,8 @@ qemuMonitorJSONFindLinkPath(qemuMonitor *mon, int qemuMonitorJSONMigrateIncoming(qemuMonitor *mon, - const char *uri) + const char *uri, + virTristateBool exitOnError) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int