Deleting external snapshots has been unimplemented so far. This series aims to enable limited functionality in that direction, handling just the common cases for now. The intention is to subsequently build upon this to eventually cover the more complex/exotic cases as well. It works by blockcommitting the snapshot to be deleted into its parent. Handles both deleting children as well and deleting children only (by committing the children into the snapshot referred to by snapshot-delete argument). If the necessary block commit operations turns out to be active (the snapshot referred to by snapshot-delete argument is current, or deleting children is requested) pivot is performed as well. This implemetation is limited to the straightforward case which assumes no branching snapshot chains below the snapshot to be deleted, and the current snapshot has to be the leaf of the (linear) chain starting at the snapshot to be deleted. These requirements are checked and enforced at the top of qemuDomainSnapshotDeleteExternal(). They might even be too restrictive for the case where deletion of children is not requested as in that case, requiring that the parent of the snapshot to be deleted not be a branching point in snapshot tree should be enough. The above limitations do not appear too severe under the current state of matters where a major source of branching snapshot structures, snapshot-revert, is not even implemented for external snapshots yet. The only other known cause of branching in external snapshots thus seems to be if a user creates branching by manually creating snapshot images and metadata and applies them using snapshot-create --redefine. Also, the snapshot images involved basically have to be files. This does not seem overly limiting either, at least for the time being, because it's a limitation shared with the underlying blockcommit code. Just as the existing code, the new code ultimately relies on virStorageFileChainLookup() as its image comparison and look-up engine and is affected by its limitaions. At any rate, this work should be understood as just a first step to a full support of deleting external snapshots. The first 5 commits of this series are just refactors used by the last 5 commits which actually implement snapshot deletion. However, the qemuDomainBlockCommit() refactor (the initial 2 commits of this series) was affected by a rather hairy merge on rebasing to the current master and although I tried to do my best to get the merge right I still feel a careful review is in order for these two commits. Pavel Mores (10): qemu: block: factor implementation out of qemuDomainBlockCommit() qemu: block: refactor blockcommit so that it's callable with storage sources qemu: block: factor implementation out of qemuDomainBlockJobAbort() conf: rename virDomainMomentFindLeaf() to virDomainMomentObjListFindLeaf() conf: add virDomainMomentFindLeaf() which operates on virDomainMomentObjPtr qemu: block: add function to collect blockcommit params and verify them qemu: block: add function to launch all prepared blockcommits qemu: block: add function to wait for blockcommits and collect results qemu: block: add external snapshot-delete top-level algorithm qemu: block: add actual invocation of external snapshot-delete src/conf/virdomaincheckpointobjlist.c | 2 +- src/conf/virdomainmomentobjlist.c | 27 +- src/conf/virdomainmomentobjlist.h | 3 +- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 552 ++++++++++++++++++++++---- 5 files changed, 485 insertions(+), 100 deletions(-) -- 2.24.1