This implements virDomainSnapshotDelete API to support external snapshots. The support doesn't include flags VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN and VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY as it would add more complexity and IMHO these flags should not existed at all. Gitlab repo with the patches: https://gitlab.com/phrdina/libvirt/-/commits/snapshot-delete-external Changes in v3: - added new patch to store snapshotDelete in status XML - fixed aborting jobs when daemon is restarted only when snapshot delete was previously stared Changes in v2: - qemuBlockCommit properly unrefs job by calling qemuBlockJobStartupFinalize - added comment to various functions - renamed some functions as suggested in review of v1 patches - improved error messages - introduced virStorageSourceChainLookupBySource() - use virStorageSourceIsBacking() - properly cleanup qemuSnapshotDeleteExternalData - don't allow deleting snapshot if there is another block job Pavel Hrdina (32): libvirt: introduce VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE qemu_block: extract block commit code to separate function qemu_block: move qemuDomainBlockPivot out of qemu_driver qemu_block: add async domain job support to qemuBlockCommit qemu_block: add async domain job support to qemuBlockPivot qemu_monitor: introduce qemuMonitorJobFinalize qemu_monitor_json: allow configuring autofinalize for block commit qemu_block: allow configuring autofinalize for block commit qemu_block: introduce qemuBlockFinalize qemu_block: change qemuBlockCommit to return job pointer qemu_blockjob: process QEMU_MONITOR_JOB_STATUS_PENDING signal storage_source: introduce virStorageSourceChainLookupBySource qemu_snapshot: refactor qemuSnapshotDelete qemu_snapshot: introduce qemuSnapshotDeleteSingle qemu_snapshot: introduce qemuSnapshotDeleteChildren qemu_snapshot: rework snapshot children deletion qemu_snapshot: move snapshot discard out of qemu_domain.c qemu_snapshot: move snapshot metadata reparent code qemu_snapshot: introduce qemuSnapshotDiscardMetadata qemu_snapshot: introduce qemuSnapshotDeleteValidate function qemu_snapshot: refactor validation of snapshot delete qemu_snapshot: error out when deleting internal snapshot on non-active disk qemu_snapshot: convert snapshot delete to async domain job qemu_snapshot: prepare data for external snapshot deletion qemu_snapshot: implement deletion of external snapshot qemu_snapshot: update metadata when deleting snapshots qemu_snapshot: when deleting snapshot invalidate parent snapshot qemu_domain: store snapshotDelete in qemuDomainJobPrivate qemu_process: abort snapshot delete when daemon starts qemu_snapshot: enable deletion of external snapshots api: document support for external snapshot deletion NEWS: document support for external snapshot deletion NEWS.rst | 6 + include/libvirt/libvirt-domain.h | 1 + src/conf/snapshot_conf.c | 8 + src/conf/snapshot_conf.h | 1 + src/libvirt-domain-snapshot.c | 7 + src/libvirt_private.syms | 1 + src/qemu/qemu_backup.c | 1 + src/qemu/qemu_block.c | 364 +++++++++++ src/qemu/qemu_block.h | 22 + src/qemu/qemu_blockjob.c | 21 +- src/qemu/qemu_blockjob.h | 1 + src/qemu/qemu_domain.c | 118 +--- src/qemu/qemu_domain.h | 11 +- src/qemu/qemu_driver.c | 292 +-------- src/qemu/qemu_monitor.c | 21 +- src/qemu/qemu_monitor.h | 8 +- src/qemu/qemu_monitor_json.c | 26 +- src/qemu/qemu_monitor_json.h | 8 +- src/qemu/qemu_process.c | 37 ++ src/qemu/qemu_snapshot.c | 981 +++++++++++++++++++++++++++--- src/qemu/qemu_snapshot.h | 4 + src/storage_file/storage_source.c | 40 ++ src/storage_file/storage_source.h | 6 + tests/qemumonitorjsontest.c | 4 +- tools/virsh-domain.c | 1 + 25 files changed, 1514 insertions(+), 476 deletions(-) -- 2.39.0