On Thu, Sep 01, 2022 at 03:53:31PM +0200, Peter Krempa wrote: > On Tue, Aug 23, 2022 at 18:32:13 +0200, Pavel Hrdina wrote: > > Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> > > --- > > src/qemu/qemu_snapshot.c | 46 ++++++++++++++++++++++++++-------------- > > 1 file changed, 30 insertions(+), 16 deletions(-) > > > > diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c > > index c1c67ac445..b5e6a87566 100644 > > --- a/src/qemu/qemu_snapshot.c > > +++ b/src/qemu/qemu_snapshot.c > > @@ -2281,6 +2281,35 @@ qemuSnapshotChildrenReparent(void *payload, > > } > > > > > > +static int > > +qemuSnapshotDeleteSingle(virDomainObj *vm, > > + virDomainMomentObj *snap, > > + virQEMUDriver *driver, > > + bool metadata_only) > > +{ > > 'driver' can be extracted from the the private data of 'vm', removing > the need to pass it in. Doing that will also remove the need to pass it > in via 'struct qemuSnapshotDeleteAllData' in upcoming patch. I'll drop it from this function, good point, thanks. > > + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); > > + > > + if (snap->nchildren) { > > + virQEMUMomentReparent rep; > > + > > + rep.dir = cfg->snapshotDir; > > + rep.parent = snap->parent; > > + rep.vm = vm; > > + rep.err = 0; > > + rep.xmlopt = driver->xmlopt; > > + rep.writeMetadata = qemuDomainSnapshotWriteMetadata; > > + virDomainMomentForEachChild(snap, > > + qemuSnapshotChildrenReparent, > > + &rep); > > + if (rep.err < 0) > > + return -1; > > + virDomainMomentMoveChildren(snap, snap->parent); > > + } > > + > > + return qemuDomainSnapshotDiscard(driver, vm, snap, true, metadata_only); > > You actually may be better off refactoring qemuDomainSnapshotDiscard > first to remove the argument. This can be done as a followup series otherwise it will open another can of worms and would end up in a lot of patches. Pavel
Attachment:
signature.asc
Description: PGP signature