• E
    snapshot: use metaroot node to simplify management · 06d4a1e4
    Eric Blake 提交于
    This idea was first suggested by Daniel Veillard here:
    https://www.redhat.com/archives/libvir-list/2011-October/msg00353.html
    
    Now that I am about to add more complexity to snapshot listing, it
    makes sense to avoid code duplication and special casing for domain
    listing (all snapshots) vs. snapshot listing (descendants); adding
    a metaroot reduces the number of code lines by having the domain
    listing turn into a descendant listing of the metaroot.
    
    Note that this has one minor pessimization - if we are going to list
    ALL snapshots without filtering, then virHashForeach is more efficient
    than recursing through the child relationships; restoring that minor
    optimization will occur in the next patch.
    
    * src/conf/domain_conf.h (_virDomainSnapshotObj)
    (_virDomainSnapshotObjList): Repurpose some fields.
    (virDomainSnapshotDropParent): Drop unused parameter.
    * src/conf/domain_conf.c (virDomainSnapshotObjListGetNames)
    (virDomainSnapshotObjListCount): Simplify.
    (virDomainSnapshotFindByName, virDomainSnapshotSetRelations)
    (virDomainSnapshotDropParent): Match new field semantics.
    * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML)
    (qemuDomainSnapshotReparentChildren, qemuDomainSnapshotDelete):
    Adjust clients.
    06d4a1e4
domain_conf.h 68.8 KB