On Tue, May 10, 2022 at 17:21:03 +0200, Jiri Denemark wrote: > When libvirt daemon is restarted during an active post-copy migration, > we do not always mark the migration as broken. In this phase libvirt is > not really needed for migration to finish successfully. In fact the > migration could have even finished while libvirt was not running or it > may still be happily running. > > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> > --- > src/qemu/qemu_migration.c | 27 +++++++++++++++++++++++++++ > src/qemu/qemu_migration.h | 6 ++++++ > src/qemu/qemu_process.c | 39 +++++++++++++++++++++++++++++---------- > 3 files changed, 62 insertions(+), 10 deletions(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index dacea63610..854dfd43c1 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -2460,6 +2460,33 @@ qemuMigrationSrcBeginPhaseBlockDirtyBitmaps(qemuMigrationCookie *mig, > } > > > +int > +qemuMigrationAnyRefreshStatus(virQEMUDriver *driver, > + virDomainObj *vm, > + virDomainAsyncJob asyncJob, > + virDomainJobStatus *status) > +{ > + g_autoptr(virDomainJobData) jobData = NULL; > + qemuDomainJobDataPrivate *priv; > + > + jobData = virDomainJobDataInit(&qemuJobDataPrivateDataCallbacks); > + priv = jobData->privateData; > + > + if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, NULL) < 0) > + return -1; > + > + qemuMigrationUpdateJobType(jobData); > + VIR_DEBUG("QEMU reports domain '%s' is in '%s' migration state, " > + "translated as %d", Diagnostics on a single line please > + vm->def->name, > + qemuMonitorMigrationStatusTypeToString(priv->stats.mig.status), > + jobData->status); > + > + *status = jobData->status; > + return 0; > +} > + [...] > @@ -3731,7 +3728,29 @@ qemuProcessRecoverMigration(virQEMUDriver *driver, > return -1; > > if (rc > 0) { > - qemuProcessRestoreMigrationJob(vm, job); > + if (migStatus == VIR_DOMAIN_JOB_STATUS_POSTCOPY) { > + VIR_DEBUG("Post-copy migration of domain %s still running, it " > + "will be handled as unattended", vm->def->name); This one too. Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>