qemu: Add support for postcopy-recover QEMU migration state

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2022-05-10 15:20:25 +02:00
parent 5dd2d11ec0
commit 73b81fc55f
5 changed files with 29 additions and 1 deletions

View File

@ -1744,6 +1744,7 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData)
switch ((qemuMonitorMigrationStatus) priv->stats.mig.status) {
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY;
break;

View File

@ -149,7 +149,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
"inactive", "setup",
"active", "pre-switchover",
"device", "postcopy-active",
"postcopy-paused",
"postcopy-paused", "postcopy-recover",
"completed", "failed",
"cancelling", "cancelled",
"wait-unplug",

View File

@ -796,6 +796,7 @@ typedef enum {
QEMU_MONITOR_MIGRATION_STATUS_DEVICE,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER,
QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
QEMU_MONITOR_MIGRATION_STATUS_ERROR,
QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,

View File

@ -3243,6 +3243,7 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValue *reply,
case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING:
case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:

View File

@ -1524,6 +1524,31 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
}
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
if (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",
vm->def->name,
virDomainStateTypeToString(state),
NULLSTR(virDomainStateReasonToString(state, reason)));
virDomainObjSetState(vm, state, reason);
event = virDomainEventLifecycleNewFromObj(vm, eventType, eventDetail);
qemuDomainSaveStatus(vm);
}
break;
case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
case QEMU_MONITOR_MIGRATION_STATUS_SETUP:
case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE: