On Tue, Sep 30, 2014 at 16:39:25 +0200, Cristian Klein wrote: > Signed-off-by: Cristian Klein <cristian.klein@xxxxxxxxx> > --- > src/qemu/qemu_migration.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ > src/qemu/qemu_migration.h | 3 ++- > 2 files changed, 62 insertions(+), 1 deletion(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index 284cd5a..4a36946 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -1801,6 +1801,49 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver, > > > static int > +qemuMigrationSetPostCopy(virQEMUDriverPtr driver, > + virDomainObjPtr vm, > + qemuDomainAsyncJob job) > +{ > + qemuDomainObjPrivatePtr priv = vm->privateData; > + int ret; > + > + if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0) > + return -1; > + > + ret = qemuMonitorGetMigrationCapability( > + priv->mon, > + QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY); > + > + if (ret < 0) { > + goto cleanup; > + } else if (ret == 0) { > + if (job == QEMU_ASYNC_JOB_MIGRATION_IN) { > + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > + _("Post-copy migration is not supported by " > + "target QEMU binary")); > + } else { > + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > + _("Post-copy migration is not supported by " > + "source QEMU binary")); > + } > + ret = -1; > + goto cleanup; > + } > + > + /* Post-copy only needs to be enabled on source qemu, > + * for target, this function only acts as a capability check */ > + if (job == QEMU_ASYNC_JOB_MIGRATION_OUT) { > + ret = qemuMonitorSetMigrationCapability( > + priv->mon, > + QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY); > + } > + > + cleanup: > + qemuDomainObjExitMonitor(driver, vm); > + return ret; > +} Unless we need to try to set the capability to check whether it is really available (which is not what the current code does), I think it would make more sense to limit this function to source side only and let destination call qemuMonitorGetMigrationCapability directly. Empty lines missing between qemuMigrationSetPostCopy and qemuMigrationSetCompression. > +static int > qemuMigrationSetCompression(virQEMUDriverPtr driver, > virDomainObjPtr vm, > qemuDomainAsyncJob job) > @@ -2741,6 +2784,11 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, > dataFD[1] = -1; /* 'st' owns the FD now & will close it */ > } > > + if (flags & VIR_MIGRATE_POSTCOPY && > + qemuMigrationSetPostCopy(driver, vm, > + QEMU_ASYNC_JOB_MIGRATION_IN) < 0) > + goto stop; > + Just call qemuMonitorGetMigrationCapability directly here. > if (flags & VIR_MIGRATE_COMPRESSED && > qemuMigrationSetCompression(driver, vm, > QEMU_ASYNC_JOB_MIGRATION_IN) < 0) > @@ -3583,6 +3631,18 @@ qemuMigrationRun(virQEMUDriverPtr driver, > QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) > goto cleanup; > > + if (flags & VIR_MIGRATE_POSTCOPY) { > + if (!(flags & VIR_MIGRATE_LIVE)) { > + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", > + _("Enabling post-copy only makes sense with " > + "live migration")); > + goto cleanup; > + } > + if (qemuMigrationSetPostCopy(driver, vm, > + QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) > + goto cleanup; > + } > + > if (qemuDomainObjEnterMonitorAsync(driver, vm, > QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) > goto cleanup; > diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h > index e7a90c3..349c9c4 100644 > --- a/src/qemu/qemu_migration.h > +++ b/src/qemu/qemu_migration.h > @@ -41,7 +41,8 @@ > VIR_MIGRATE_COMPRESSED | \ > VIR_MIGRATE_ABORT_ON_ERROR | \ > VIR_MIGRATE_AUTO_CONVERGE | \ > - VIR_MIGRATE_RDMA_PIN_ALL) > + VIR_MIGRATE_RDMA_PIN_ALL | \ > + VIR_MIGRATE_POSTCOPY) > > /* All supported migration parameters and their types. */ > # define QEMU_MIGRATION_PARAMETERS \ Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list