On Tue, May 10, 2022 at 17:20:44 +0200, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 1 +
src/qemu/qemu_process.c | 31 ++++++++++++++++++++++++++++++-
5 files changed, 34 insertions(+), 2 deletions(-)
[...]
@@ -1590,6 +1593,32 @@ qemuProcessHandleMigrationStatus(qemuMonitor
*mon G_GNUC_UNUSED,
}
}
+ if ((status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY ||
+ status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER) &&
+ virDomainObjIsFailedPostcopy(vm)) {
+ int eventType = -1;
+ int eventDetail = -1;
+
+ if (state == VIR_DOMAIN_PAUSED) {
+ reason = VIR_DOMAIN_PAUSED_POSTCOPY;
+ eventType = VIR_DOMAIN_EVENT_SUSPENDED;
+ eventDetail = qemuDomainPausedReasonToSuspendedEvent(reason);
+ } else {
+ reason = VIR_DOMAIN_RUNNING_POSTCOPY;
+ eventType = VIR_DOMAIN_EVENT_RESUMED;
+ eventDetail = qemuDomainRunningReasonToResumeEvent(reason);
+ }
+
+ VIR_DEBUG("Post-copy migration recovered; correcting state for domain
"
+ "%s to %s/%s",
Preferrably conform to the error message coding style here:
- no linebreaks
- all substitutions should be somehow enclosed e.g. in '%s'
+ vm->def->name,
+ virDomainStateTypeToString(state),
+ NULLSTR(virDomainStateReasonToString(state, reason)));
+ virDomainObjSetState(vm, state, reason);
+ event = virDomainEventLifecycleNewFromObj(vm, eventType, eventDetail);
+ qemuDomainSaveStatus(vm);
+ }
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>