On Wed, Jul 08, 2015 at 19:36:00 +0200, Jiri Denemark wrote: > Separate code which makes incoming domain persistent into > qemuMigrationPersist. > > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> > --- > src/qemu/qemu_migration.c | 75 ++++++++++++++++++++++++++++++----------------- > 1 file changed, 48 insertions(+), 27 deletions(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index 97901c6..6b06e79 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -5526,6 +5526,51 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) > } > > > +static int > +qemuMigrationPersist(virQEMUDriverPtr driver, > + virDomainObjPtr vm, > + qemuMigrationCookiePtr mig) > +{ > + virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); > + virCapsPtr caps = NULL; > + virDomainDefPtr vmdef; > + virObjectEventPtr event; > + bool newVM; > + int ret = -1; > + > + if (!(caps = virQEMUDriverGetCapabilities(driver, false))) > + goto cleanup; > + > + newVM = !vm->persistent; > + vm->persistent = 1; > + > + if (mig->persistent) > + vm->newDef = mig->persistent; This could be done unconditionally since vm->newDef will apperently be unset. > + > + vmdef = virDomainObjGetPersistentDef(caps, driver->xmlopt, vm); > + if (!vmdef) > + goto cleanup; > + > + if (virDomainSaveConfig(cfg->configDir, vmdef) < 0) > + goto cleanup; > + > + event = virDomainEventLifecycleNewFromObj(vm, > + VIR_DOMAIN_EVENT_DEFINED, > + newVM ? > + VIR_DOMAIN_EVENT_DEFINED_ADDED : > + VIR_DOMAIN_EVENT_DEFINED_UPDATED); > + if (event) > + qemuDomainEventQueue(driver, event); > + > + ret = 0; > + > + cleanup: > + virObjectUnref(caps); > + virObjectUnref(cfg); > + return ret; > +} > + > + > virDomainPtr > qemuMigrationFinish(virQEMUDriverPtr driver, > virConnectPtr dconn, ACK as-is. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list