Skip to content

Commit

Permalink
warm migration: remove prev snapshot before pause
Browse files Browse the repository at this point in the history
The migration controller currently waits until the next
precopy phase starts to remove the old snapshot.
Deleting the previous snapshot prior to pausing should
speed the process up.

Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam committed Nov 18, 2024
1 parent b75f9ab commit b3998c6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const (
StoreSnapshotDeltas = "StoreSnapshotDeltas"
StoreInitialSnapshotDeltas = "StoreInitialSnapshotDeltas"
RemovePreviousSnapshot = "RemovePreviousSnapshot"
RemovePenultimateSnapshot = "RemovePenultimateSnapshot"
RemoveFinalSnapshot = "RemoveFinalSnapshot"
)

Expand Down Expand Up @@ -134,16 +133,15 @@ var (
{Name: StoreInitialSnapshotDeltas, All: VSphere},
{Name: CreateDataVolumes},
{Name: CopyDisks},
{Name: CopyingPaused},
{Name: RemovePreviousSnapshot, All: VSphere},
{Name: CopyingPaused},
{Name: CreateSnapshot},
{Name: WaitForSnapshot},
{Name: StoreSnapshotDeltas, All: VSphere},
{Name: AddCheckpoint},
{Name: StorePowerState},
{Name: PowerOffSource},
{Name: WaitForPowerOff},
{Name: RemovePenultimateSnapshot, All: VSphere},
{Name: CreateFinalSnapshot},
{Name: WaitForFinalSnapshot},
{Name: AddFinalCheckpoint},
Expand Down Expand Up @@ -663,7 +661,7 @@ func (r *Migration) step(vm *plan.VMStatus) (step string) {
step = DiskAllocation
case CopyDisks, CopyingPaused, RemovePreviousSnapshot, CreateSnapshot, WaitForSnapshot, StoreSnapshotDeltas, AddCheckpoint, ConvertOpenstackSnapshot:
step = DiskTransfer
case RemovePenultimateSnapshot, CreateFinalSnapshot, WaitForFinalSnapshot, AddFinalCheckpoint, Finalize, RemoveFinalSnapshot:
case CreateFinalSnapshot, WaitForFinalSnapshot, AddFinalCheckpoint, Finalize, RemoveFinalSnapshot:
step = Cutover
case CreateGuestConversionPod, ConvertGuest:
step = ImageConversion
Expand Down Expand Up @@ -988,7 +986,7 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) {
} else if vm.Warm.NextPrecopyAt != nil && !vm.Warm.NextPrecopyAt.After(time.Now()) {
vm.Phase = r.next(vm.Phase)
}
case RemovePreviousSnapshot, RemovePenultimateSnapshot, RemoveFinalSnapshot:
case RemovePreviousSnapshot, RemoveFinalSnapshot:
step, found := vm.FindStep(r.step(vm))
if !found {
vm.AddError(fmt.Sprintf("Step '%s' not found", r.step(vm)))
Expand Down

0 comments on commit b3998c6

Please sign in to comment.