Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: fix snapshot remove when image already merged
When trying to remove a snapshot which was already removed before and image merged, but not removed from the DB for some reason - the RemoveSnapshot command fails and the snapshot and images stay in the DB and cannot be removed. The reason for this is that during RemoveSnapshotSingleDiskLiveCommand the DestroyImage command fails (since the image does not not exist), thus the whole command fails, and the snapshot/image are not removed from the DB. In the ColdMerge case, the ColdMergeSnapshotSingleDiskCommand fails already at the PrepareMerge stage. In this change, for both Live and Cold merge - we first check that the Destination image (or the Top Image) exists on storage with GetVolumeInfo. If it does not, we conclude that it was already merged and removed, and proceed to finishing the command successfully and removing the snapshot and the image from the DB, skipping all the steps. Bug-Url: https://bugzilla.redhat.com/1948599
- Loading branch information