[libvirt] [PATCH 1/5] snapshots: Add flag to guarantee topological sort

Daniel P. Berrangé berrange at redhat.com
Tue Mar 12 17:27:07 UTC 2019


On Tue, Mar 12, 2019 at 05:03:32PM +0100, Ján Tomko wrote:
> On Fri, Mar 08, 2019 at 12:05:08AM -0600, Eric Blake wrote:
> > When doing REDEFINE on multiple snapshot metadata XML descriptions, we
> > require that a child cannot be redefined before its parent.  Since
> > libvirt already tracks a DAG, it is more convenient if we can ensure
> > that virDomainListAllSnapshots() and friends have a way to return data
> > in an order that we can directly reuse, rather than having to
> > post-process the data ourselves to reconstruct the DAG.
> > 
> > Add VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL as our new guarantee (well, a
> > guarantee at the time of the API call conclusion; there's always a
> > possible TOCTTOU race where someone redefining snapshots in between
> > the API results and the client actually using the list might render
> > the list out-of-date). Four listing APIs are directly benefitted by
> > the new flag; additionally, since we document that the older racy
> > ListNames interfaces should be sized by using the same flags on their
> > Num counterparts, the Num interfaces must document when they accept
> > (and ignore) the flag.
> > 
> 
> I'd rather deal with that by not introducing the new flag to the old
> APIs. The ListAll APIs were introduced back in 2012 and are even older
> than the minimum QEMU version we support.

I don't much like that idea. The existing virDomainSnapshotListFlags
constants apply to all the APIs. Special casing the new enum constant
so that it only applies to some of the APIs is needlessly creating an
inconsistency for no obvious benefit.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list