Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix snapshot removal when image already merged #524

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

mkemel
Copy link
Member

@mkemel mkemel commented Jul 13, 2022

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

@mkemel
Copy link
Member Author

mkemel commented Jul 13, 2022

Need to check ColdMerge as well, that's why drafting it for now.
@bennyz @ahadas can you take a look?

@mkemel mkemel requested review from ahadas and bennyz July 13, 2022 10:24
@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch 3 times, most recently from c366725 to 6cc791a Compare July 17, 2022 17:26
@mkemel mkemel marked this pull request as ready for review July 18, 2022 06:25
@ahadas ahadas added the storage label Jul 24, 2022
@ahadas ahadas changed the title core: fix snapshot remove when image already merged fix snapshot removal when image already merged Jul 24, 2022
@sandrobonazzola sandrobonazzola added this to the ovirt-4.5.2 milestone Jul 27, 2022
@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch from 6cc791a to 37a44f2 Compare August 2, 2022 05:54
@mkemel
Copy link
Member Author

mkemel commented Aug 2, 2022

Ended up skipping the check that the volume is not in the chain already, as Benny suggested.
If the volume is there after Merge for some reason -> the chain will be checked during MergeStatus, and if everything is fine - it will be removed during Destroy
If the volume does not exist -> then probably the Merge was completed successfully.

Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this approach looks good to me

@mkemel
Copy link
Member Author

mkemel commented Aug 3, 2022

/ost

@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch 3 times, most recently from 262eafd to 561123f Compare August 4, 2022 09:15
@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch from 561123f to 5056166 Compare August 4, 2022 14:14
@mkemel mkemel requested a review from bennyz August 4, 2022 14:16
@ahadas ahadas self-requested a review August 7, 2022 06:48
@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch from 5056166 to 34b81e6 Compare August 7, 2022 07:45
@mkemel mkemel force-pushed the fix_remove_snapshot_with_merged_image branch from 34b81e6 to b45be93 Compare August 7, 2022 09:32
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
@ahadas ahadas force-pushed the fix_remove_snapshot_with_merged_image branch from b45be93 to fdcdcac Compare August 7, 2022 10:05
@mkemel
Copy link
Member Author

mkemel commented Aug 7, 2022

/ost

@ahadas ahadas merged commit 9c7e00c into oVirt:master Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants