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

Eric Blake eblake at redhat.com
Tue Mar 12 16:10:46 UTC 2019


On 3/12/19 11:03 AM, 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.

It's easy enough (in later patches) to NOT accept the new flag in the
virCheckFlags() macro for the implementation of those functions. On the
other hand, it's trivial to support. But if you don't like new flags to
old APIs, even though the old and new APIs share a common enum, I can
make that change.

> 
> Reviewed-by: Ján Tomko <jtomko at redhat.com>
> 
> Jano

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190312/5e959fc6/attachment-0001.sig>


More information about the libvir-list mailing list