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

core: reverse snapshots list #263

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,17 @@ protected void setActionMessageParameters() {

private void sortImages() {

// Sort images from parent to leaf (active) - needed only once as the sorted list is
// being saved in the parameters. The conditions to check vary between cold and live
// merge (and we can't yet run isLiveMerge()), so we just use an explicit flag.
if (!getParameters().isImageIdsSorted()) {
// Retrieve and sort the entire chain of images
List<DiskImage> images = getAllImagesForDisk();
ImagesHandler.sortImageList(images);

// We reverse the list here because since 4.4 we use block commit which merges the child into
// the snapshot we remove. To prevent a situation where the child was already removed we need
// reverse the list to ensure the children are removed first, so we don't attempt to remove them
// again.
Collections.reverse(images);
ahadas marked this conversation as resolved.
Show resolved Hide resolved

// Get a sorted list of the selected images
List<DiskImage> sortedImages =
images.stream()
Expand Down