On Tue, May 10, 2022 at 05:21:22PM +0200, Jiri Denemark wrote: > Offline migration jumps over a big part of qemuMigrationDstPrepareFresh. > Let's move that part into a new qemuMigrationDstPrepareActive function > to make the code easier to follow. > > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> > --- > src/qemu/qemu_migration.c | 374 +++++++++++++++++++++----------------- > 1 file changed, 206 insertions(+), 168 deletions(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index f1e3774034..dc608fb8a4 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -3118,6 +3118,200 @@ qemuMigrationDstPrepareAnyBlockDirtyBitmaps(virDomainObj *vm, > } > > > +static int > +qemuMigrationDstPrepareActive(virQEMUDriver *driver, > + virDomainObj *vm, > + virConnectPtr dconn, > + qemuMigrationCookie *mig, > + virStreamPtr st, > + const char *protocol, > + unsigned short port, > + const char *listenAddress, > + size_t nmigrate_disks, > + const char **migrate_disks, > + int nbdPort, > + const char *nbdURI, > + qemuMigrationParams *migParams, > + unsigned long flags) > +{ [...] > + if (qemuProcessFinishStartup(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, > + false, VIR_DOMAIN_PAUSED_MIGRATION) < 0) > + goto error; > + > + if (!(flags & VIR_MIGRATE_OFFLINE)) { No need for this check because the function call is guarded by the same check. > + virDomainAuditStart(vm, "migrated", true); > + event = virDomainEventLifecycleNewFromObj(vm, > + VIR_DOMAIN_EVENT_STARTED, > + VIR_DOMAIN_EVENT_STARTED_MIGRATED); > + } > + > + ret = 0; > + [...] > @@ -3140,32 +3334,20 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, > unsigned long flags) > { [...] > + if (!(flags & VIR_MIGRATE_OFFLINE)) { > + if (qemuMigrationDstPrepareActive(driver, vm, dconn, mig, st, > + protocol, port, listenAddress, > + nmigrate_disks, migrate_disks, > + nbdPort, nbdURI, > + migParams, flags) < 0) {
Attachment:
signature.asc
Description: PGP signature