On Wed, Sep 25, 2019 at 14:54:41 +0200, Peter Krempa wrote: > Move all extensive functions to a new file so that we don't just pile > everything in the common files. This obviously isn't possible with > straight code movement as we still need stubs in qemu_driver.c > > Additionally some functions e.g. for looking up a checkpoint by name > were so short that moving the impl didn't make sense. > > Note that in the move the new file also doesn't use > virQEMUMomentReparent but rather an stripped down copy. As I plan to > split out snapshot code into a separate file the unification doesn't > make sense any more. > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > src/qemu/Makefile.inc.am | 2 + > src/qemu/qemu_checkpoint.c | 483 +++++++++++++++++++++++++++++++++++++ > src/qemu/qemu_checkpoint.h | 50 ++++ > src/qemu/qemu_driver.c | 382 +---------------------------- > 4 files changed, 540 insertions(+), 377 deletions(-) > create mode 100644 src/qemu/qemu_checkpoint.c > create mode 100644 src/qemu/qemu_checkpoint.h [...] > +virDomainCheckpointPtr > +qemuCheckpointCreateXML(virDomainPtr domain, > + virDomainObjPtr vm, > + const char *xmlDesc, > + unsigned int flags) > +{ [...] > + endjob: > + if (checkpoint) { > + if (update_current) > + virDomainCheckpointSetCurrent(vm->checkpoints, chk); > + if (qemuDomainCheckpointWriteMetadata(vm, chk, driver->caps, > + driver->xmlopt, > + cfg->checkpointDir) < 0) { > + /* if writing of metadata fails, error out rather than trying > + * to silently carry on without completing the checkpoint */ > + virObjectUnref(checkpoint); > + checkpoint = NULL; > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("unable to save metadata for checkpoint %s"), > + chk->def->name); > + virDomainCheckpointObjListRemove(vm->checkpoints, chk); > + } else { > + virDomainCheckpointLinkParent(vm->checkpoints, chk); > + } > + } else if (chk) { > + virDomainCheckpointObjListRemove(vm->checkpoints, chk); > + } > + > + qemuDomainObjEndJob(driver, vm); > + > + cleanup: > + virJSONValueFree(actions); > + virDomainObjEndAPI(&vm); This is already called in qemu_driver.c so we'd try to release the object twice as we don't pass it in via a double pointer. I've deleted the above line from my private branch. > + virObjectUnref(caps); > + virObjectUnref(cfg); > + return checkpoint; > +} -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list