feat: remove cephmig snapshots during sync and add cleanup command

Users of a subvolume should not see traces of the migration. Each sync
round now deletes the older cephmig-* round snapshots at source and
target and keeps only the newest one as base for the next round. The new
command `cephmig cleanup` deletes the remaining one after the cutover.
Application snapshots are never touched.

The journal marks a snapshot as removed before deleting it, so an
interrupted run finishes the deletion instead of reporting a vanished
snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 19:52:13 +01:00
1 parent cc2dff46a0
commit 907d400765
9 files changed
+322 -19

No files matched your search

+9
View File
@@ -450,6 +450,10 @@ func (e Engine) Sync(ctx context.Context, c Config, statePath string, final bool
// Resume all intent records before capturing another live snapshot.
for i := range s.Snapshots {
if s.Snapshots[i].Removed {
continue
}
if s.Snapshots[i].Done {
snap := &s.Snapshots[i]
if !slices.Contains(targetNames, snap.Name) {
@@ -504,6 +508,11 @@ func (e Engine) Sync(ctx context.Context, c Config, statePath string, final bool
return err
}
// Only the newest round snapshot serves as base for the next round.
if err = removeOwnedSnapshots(ctx, src, dst, abs, s, s.LiveSnapshot); err != nil {
return err
}
metadata, err := src.metadata(ctx, "")
if err != nil {
return err