Skip to content

Commit

Permalink
Do not migrate legacy images if snapshots are already present
Browse files Browse the repository at this point in the history
This commit prevents executing the legacy images migration logic
if snapshotter already finds available snapshots. This mostly
means the migration was already executed and legacy images
had already a chance to be converted into snapshots.

Signed-off-by: David Cassany <dcassany@suse.com>
  • Loading branch information
davidcassany committed Mar 5, 2024
1 parent a7fec29 commit 10b5e8d
Showing 1 changed file with 4 additions and 0 deletions.
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, there are already snapshots 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

0 comments on commit 10b5e8d

Please sign in to comment.