On Tue, May 10, 2022 at 17:21:30 +0200, Jiri Denemark wrote:
Everything was already done in the normal Finish phase and vCPUs are
running. We just need to wait for all remaining data to be transferred.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 46 ++++++++++++++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a8481f7515..430dfb1abb 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -6600,6 +6600,22 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver,
}
+static int
+qemuMigrationDstFinishResume(virQEMUDriver *driver,
+ virDomainObj *vm)
+{
+ VIR_DEBUG("vm=%p", vm);
+
+ if (qemuMigrationDstWaitForCompletion(driver, vm,
+ VIR_ASYNC_JOB_MIGRATION_IN,
+ false) < 0) {
+ return -1;
+ }
As I mentioned in another reply, IMO it would be useful to allow
adoption of a unattended running migration precisely for this case, so
that mgmt apps don't have to encode more logic to wait for events if
migration was actually running fine.
+
+ return 0;
+}
+
+
static virDomainPtr
qemuMigrationDstFinishActive(virQEMUDriver *driver,
virConnectPtr dconn,
@@ -6647,8 +6663,14 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
goto error;
}
- rc = qemuMigrationDstFinishFresh(driver, vm, mig, flags, v3proto,
- timeReceived, &doKill, &inPostCopy);
+ if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
+ rc = qemuMigrationDstFinishResume(driver, vm);
+ inPostCopy = true;
+ } else {
+ rc = qemuMigrationDstFinishFresh(driver, vm, mig, flags, v3proto,
+ timeReceived, &doKill, &inPostCopy);
+ }
+
if (rc < 0 ||
!(dom = virGetDomain(dconn, vm->def->name, vm->def->uuid,
vm->def->id)))
goto error;
@@ -6719,6 +6741,8 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
qemuDomainObjPrivate *priv = vm->privateData;
unsigned short port;
unsigned long long timeReceived = 0;
+ int phase = v3proto ? QEMU_MIGRATION_PHASE_FINISH3
+ : QEMU_MIGRATION_PHASE_FINISH2;
Avoid use of ?
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, flags=0x%lx, retcode=%d",
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>