qemu: Add support for postcopy-recover-setup migration state

This patch adds support for recognizing the new migration state reported
by QEMU when post-copy recovery is requested. It is not actually used
for anything yet.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jiri Denemark 2024-08-08 11:45:16 +02:00
parent 18fd4899f3
commit 79e0b50bb6
10 changed files with 23 additions and 0 deletions

View File

@ -106,6 +106,7 @@ virDomainJobStatusToType(virDomainJobStatus status)
case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
case VIR_DOMAIN_JOB_STATUS_PAUSED:
return VIR_DOMAIN_JOB_UNBOUNDED;

View File

@ -89,6 +89,7 @@ typedef enum {
VIR_DOMAIN_JOB_STATUS_PAUSED,
VIR_DOMAIN_JOB_STATUS_POSTCOPY,
VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED,
VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER,
VIR_DOMAIN_JOB_STATUS_COMPLETED,
VIR_DOMAIN_JOB_STATUS_FAILED,
VIR_DOMAIN_JOB_STATUS_CANCELED,

View File

@ -1873,6 +1873,8 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivate *priv)
virHashRemoveAll(priv->statsSchema);
g_slist_free_full(g_steal_pointer(&priv->threadContextAliases), g_free);
priv->migrationRecoverSetup = false;
}

View File

@ -199,6 +199,10 @@ struct _qemuDomainObjPrivate {
* private XML. */
virBitmap *migrationCaps;
/* True if QEMU supports "postcopy-recover-setup" migration state. Checked
* QEMU enters the state, not to be stored in private XML. */
bool migrationRecoverSetup;
/* true if qemu-pr-helper process is running for the domain */
bool prDaemonRunning;

View File

@ -11963,6 +11963,7 @@ qemuDomainGetJobInfoMigrationStats(virDomainObj *vm,
case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
case VIR_DOMAIN_JOB_STATUS_PAUSED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
if (qemuMigrationAnyFetchStats(vm, VIR_ASYNC_JOB_NONE,
jobData, NULL) < 0)
return -1;

View File

@ -1802,6 +1802,10 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData)
jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY;
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER;
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED;
break;
@ -1943,6 +1947,7 @@ qemuMigrationJobCheckStatus(virDomainObj *vm,
case VIR_DOMAIN_JOB_STATUS_MIGRATING:
case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
case VIR_DOMAIN_JOB_STATUS_PAUSED:
break;
}
@ -2028,6 +2033,7 @@ qemuMigrationAnyCompleted(virDomainObj *vm,
case VIR_DOMAIN_JOB_STATUS_MIGRATING:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
case VIR_DOMAIN_JOB_STATUS_PAUSED:
case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
/* The migration was aborted by us rather than QEMU itself. */
jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
return -2;
@ -4669,6 +4675,7 @@ qemuMigrationSrcIsCanceled(virDomainObj *vm)
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:
case QEMU_MONITOR_MIGRATION_STATUS_DEVICE:

View File

@ -152,6 +152,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
"postcopy-active",
"postcopy-paused",
"postcopy-recover",
"postcopy-recover-setup",
"completed",
"failed",
"cancelling",

View File

@ -762,6 +762,7 @@ typedef enum {
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP,
QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
QEMU_MONITOR_MIGRATION_STATUS_ERROR,
QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,

View File

@ -2969,6 +2969,7 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValue *reply,
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_POSTCOPY_RECOVER_SETUP:
case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING:
case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:

View File

@ -1503,6 +1503,10 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
}
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
priv->migrationRecoverSetup = true;
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
int eventType = -1;