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

Do not migrate legacy images if snapshots are already present #1990

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pkg/features/embedded/grub-config/etc/elemental/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ function set_volume {
set btrfs_relative_path="y"
set volume="${root}"
if [ -n "${1}" ]; then
set img=${1}
btrfs-mount-subvol ($root) / @/.snapshots/${1}/snapshot
set img=@/.snapshots/${1}/snapshot
btrfs-mount-subvol ($root) / ${img}
fi
elif [ -z "${1}" ]; then
set_loopdevice /.snapshots/active
Expand Down
4 changes: 4 additions & 0 deletions pkg/snapshotter/loopdevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ func (l *LoopDevice) legacyImageToSnapsot(image string) error {
l.cfg.Logger.Errorf("failed setting the snaphsot ID for legacy images: %v", err)
return err
}
if id > 1 {
l.cfg.Logger.Debugf("Skipping legacy image migration, some snapshot already found in the system")
return nil
}
l.cfg.Logger.Debugf("Migrating image %s to snapshot %d", image, id)

snapPath := filepath.Join(l.rootDir, loopDeviceSnapsPath, strconv.FormatInt(int64(id), 10))
Expand Down
Loading