mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
qemu: Introduce qemuProcessCleanupMigrationJob
The function can be used as a callback for qemuDomainCleanupAdd to automatically clean up a migration job when a domain is destroyed. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
83ccd3a3d1
commit
7c1840fa37
@ -3360,6 +3360,31 @@ qemuProcessUpdateState(virQEMUDriver *driver, virDomainObj *vm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuProcessCleanupMigrationJob(virQEMUDriver *driver,
|
||||
virDomainObj *vm)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virDomainState state;
|
||||
int reason;
|
||||
|
||||
state = virDomainObjGetState(vm, &reason);
|
||||
|
||||
VIR_DEBUG("driver=%p, vm=%s, asyncJob=%s, state=%s, reason=%s",
|
||||
driver, vm->def->name,
|
||||
virDomainAsyncJobTypeToString(priv->job.asyncJob),
|
||||
virDomainStateTypeToString(state),
|
||||
virDomainStateReasonToString(state, reason));
|
||||
|
||||
if (priv->job.asyncJob != VIR_ASYNC_JOB_MIGRATION_IN &&
|
||||
priv->job.asyncJob != VIR_ASYNC_JOB_MIGRATION_OUT)
|
||||
return;
|
||||
|
||||
qemuDomainObjDiscardAsyncJob(vm);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessRecoverMigrationIn(virQEMUDriver *driver,
|
||||
virDomainObj *vm,
|
||||
|
@ -241,3 +241,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuProcessQMP, qemuProcessQMPFree);
|
||||
int qemuProcessQMPStart(qemuProcessQMP *proc);
|
||||
|
||||
bool qemuProcessRebootAllowed(const virDomainDef *def);
|
||||
|
||||
void qemuProcessCleanupMigrationJob(virQEMUDriver *driver,
|
||||
virDomainObj *vm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user