mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
qemu: Update migration state according to MIGRATION event
We don't need to call query-migrate every 50ms when we get the current migration state via MIGRATION event. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
66c95964a5
commit
6d2edb6a42
@ -2552,7 +2552,11 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuDomainJobInfoPtr jobInfo = priv->job.current;
|
||||
|
||||
if (qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
|
||||
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
||||
|
||||
if (events)
|
||||
qemuMigrationUpdateJobType(jobInfo);
|
||||
else if (qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
switch (jobInfo->type) {
|
||||
@ -2571,9 +2575,15 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
||||
qemuMigrationJobName(vm), _("canceled by client"));
|
||||
return -1;
|
||||
|
||||
case VIR_DOMAIN_JOB_COMPLETED:
|
||||
/* Fetch statistics of a completed migration */
|
||||
if (events &&
|
||||
qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_JOB_BOUNDED:
|
||||
case VIR_DOMAIN_JOB_UNBOUNDED:
|
||||
case VIR_DOMAIN_JOB_COMPLETED:
|
||||
case VIR_DOMAIN_JOB_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -1510,6 +1510,36 @@ qemuProcessHandleSpiceMigrated(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessHandleMigrationStatus(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
virDomainObjPtr vm,
|
||||
int status,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
|
||||
virObjectLock(vm);
|
||||
|
||||
VIR_DEBUG("Migration of domain %p %s changed state to %s",
|
||||
vm, vm->def->name,
|
||||
qemuMonitorMigrationStatusTypeToString(status));
|
||||
|
||||
priv = vm->privateData;
|
||||
if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT &&
|
||||
priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_IN) {
|
||||
VIR_DEBUG("got MIGRATION event without a migration job");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
priv->job.current->status.status = status;
|
||||
virDomainObjBroadcast(vm);
|
||||
|
||||
cleanup:
|
||||
virObjectUnlock(vm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static qemuMonitorCallbacks monitorCallbacks = {
|
||||
.eofNotify = qemuProcessHandleMonitorEOF,
|
||||
.errorNotify = qemuProcessHandleMonitorError,
|
||||
@ -1534,6 +1564,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
|
||||
.domainNicRxFilterChanged = qemuProcessHandleNicRxFilterChanged,
|
||||
.domainSerialChange = qemuProcessHandleSerialChanged,
|
||||
.domainSpiceMigrated = qemuProcessHandleSpiceMigrated,
|
||||
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
|
||||
};
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user