mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 20:51:26 +00:00
qemu: Introduce qemuMigrationDstFinishOffline
Refactors qemuMigrationDstFinish by moving some parts to a dedicated function for easier introduction of postcopy resume code without duplicating common parts of the Finish phase. The goal is to have the following call graph: - qemuMigrationDstFinish - qemuMigrationDstFinishOffline - qemuMigrationDstFinishActive - qemuMigrationDstFinishFresh - qemuMigrationDstFinishResume 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
8ede853a9f
commit
71951e9869
@ -5808,6 +5808,32 @@ qemuMigrationDstComplete(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static virDomainPtr
|
||||||
|
qemuMigrationDstFinishOffline(virQEMUDriver *driver,
|
||||||
|
virConnectPtr dconn,
|
||||||
|
virDomainObj *vm,
|
||||||
|
qemuMigrationCookie *mig,
|
||||||
|
char **cookieout,
|
||||||
|
int *cookieoutlen)
|
||||||
|
{
|
||||||
|
virDomainPtr dom = NULL;
|
||||||
|
|
||||||
|
if (qemuMigrationDstPersist(driver, vm, mig, false) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid, -1);
|
||||||
|
|
||||||
|
if (dom &&
|
||||||
|
qemuMigrationCookieFormat(mig, driver, vm,
|
||||||
|
QEMU_MIGRATION_DESTINATION,
|
||||||
|
cookieout, cookieoutlen,
|
||||||
|
QEMU_MIGRATION_COOKIE_STATS) < 0)
|
||||||
|
VIR_WARN("Unable to encode migration cookie");
|
||||||
|
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform Finish phase of a fresh (i.e., not recovery) migration of an active
|
* Perform Finish phase of a fresh (i.e., not recovery) migration of an active
|
||||||
* domain.
|
* domain.
|
||||||
@ -5998,16 +6024,9 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_OFFLINE) {
|
if (flags & VIR_MIGRATE_OFFLINE) {
|
||||||
if (retcode == 0 &&
|
if (retcode == 0) {
|
||||||
qemuMigrationDstPersist(driver, vm, mig, false) == 0) {
|
dom = qemuMigrationDstFinishOffline(driver, dconn, vm, mig,
|
||||||
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid, -1);
|
cookieout, cookieoutlen);
|
||||||
|
|
||||||
if (dom &&
|
|
||||||
qemuMigrationCookieFormat(mig, driver, vm,
|
|
||||||
QEMU_MIGRATION_DESTINATION,
|
|
||||||
cookieout, cookieoutlen,
|
|
||||||
QEMU_MIGRATION_COOKIE_STATS) < 0)
|
|
||||||
VIR_WARN("Unable to encode migration cookie");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuMigrationJobFinish(vm);
|
qemuMigrationJobFinish(vm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user