mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
qemu: migration: don't expose incomplete job as complete
In case of real migration (not migrating to file on save, dump etc) migration info is not complete at time qemu finishes migration in normal (non postcopy) mode. We need to update disks stats, downtime info etc. Thus let's not expose this job status as completed. To archive this let's set status to 'qemu completed' after qemu reports migration is finished. It is not visible as complete job to clients. Cookie code on confirm phase will finally turn job into completed. As we don't need more things to do when migrating to file status is set to 'completed' as before in this case. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
8c46658337
commit
3f2d6d829e
@ -421,6 +421,7 @@ qemuDomainJobStatusToType(qemuDomainJobStatus status)
|
||||
|
||||
case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
|
||||
case QEMU_DOMAIN_JOB_STATUS_MIGRATING:
|
||||
case QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED:
|
||||
case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
|
||||
return VIR_DOMAIN_JOB_UNBOUNDED;
|
||||
|
||||
|
@ -103,6 +103,7 @@ typedef enum {
|
||||
QEMU_DOMAIN_JOB_STATUS_NONE = 0,
|
||||
QEMU_DOMAIN_JOB_STATUS_ACTIVE,
|
||||
QEMU_DOMAIN_JOB_STATUS_MIGRATING,
|
||||
QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED,
|
||||
QEMU_DOMAIN_JOB_STATUS_POSTCOPY,
|
||||
QEMU_DOMAIN_JOB_STATUS_COMPLETED,
|
||||
QEMU_DOMAIN_JOB_STATUS_FAILED,
|
||||
|
@ -13010,6 +13010,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
|
||||
|
||||
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE ||
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_MIGRATING ||
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED ||
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
|
||||
if (events &&
|
||||
jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
|
||||
|
@ -1354,7 +1354,7 @@ qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo)
|
||||
break;
|
||||
|
||||
case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED;
|
||||
break;
|
||||
|
||||
case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
|
||||
@ -1455,6 +1455,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
||||
case QEMU_DOMAIN_JOB_STATUS_COMPLETED:
|
||||
case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
|
||||
case QEMU_DOMAIN_JOB_STATUS_MIGRATING:
|
||||
case QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED:
|
||||
case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
|
||||
break;
|
||||
}
|
||||
@ -1517,19 +1518,19 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_COMPLETED)
|
||||
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
error:
|
||||
/* state can not be active at this point */
|
||||
/* state can not be active or completed at this point */
|
||||
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_MIGRATING ||
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
|
||||
/* The migration was aborted by us rather than QEMU itself. */
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
|
||||
return -2;
|
||||
} else if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_COMPLETED) {
|
||||
} else if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED) {
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
|
||||
return -1;
|
||||
} else {
|
||||
@ -1584,6 +1585,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
|
||||
if (VIR_ALLOC(priv->job.completed) == 0)
|
||||
*priv->job.completed = *jobInfo;
|
||||
|
||||
if (asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT &&
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED)
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user