On Mon, Aug 14, 2023 at 11:35:52 +0200, Pavel Hrdina wrote:
> This implements virDomainRevertToSnapshot to work with external
> snapshots. In addition it modifies virDomainSnapshotDelete to work
> correctly when we revert to non-leaf snapshot or when there is
> non-linear snapshot tree with multiple branches.
>
> Gitlab repo with the patches:
> https://gitlab.com/hrdina/libvirt/-/tree/snapshot-revert-external
>
> changes in v3:
>
> - `revertdisks` is properly freed in virDomainSnapshotDefDispose()
>
> - qemuSnapshotCreateQcow2Files() no longer takes `reuse` as argument
> and was changed to take `virDomainDef *` instead of `virDomainObj *`
>
> - proper commit message for `qemu_snapshot: use VIR_ASYNC_JOB_SNAPSHOT
> when reverting snapshot`
>
> - fixed incorrect usage of `ssize_t i`
>
> - dropped the weird logic from qemuSnapshotRevertExternalInactive() as
> we only need offline VM definition and preserve correct error message
> if creating qcow files fails
>
> - qemuSnapshotClearRevertdisks() correctly frees `revertdisks`
>
> - added new patches 'qemuDomainGetImageIds: pass domain definition directly`
> as we need to modify the function to take `virDomainDef *` directly
>
> - qemuSnapshotDiskHasBackingDisk() now uses qemuDomainGetImageIds() to get
> correct UID and GID for virStorageSourceGetMetadata() and also for
> virCommandRun() as well by storing it in
> `struct _qemuSnapshotDisksWithBackingStoreData`
Reviewed-by: Peter Krempa <pkrempa@redhat.com>