Skip to content

Commit

Permalink
Reduce cognitive complexity in Migration#Cancel
Browse files Browse the repository at this point in the history
Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Oct 22, 2023
1 parent 26993cb commit 663db1e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,21 @@ func (r *Migration) Cancel() error {
}
}
vm.MarkCompleted()
for _, step := range vm.Pipeline {
if step.MarkedStarted() {
step.MarkCompleted()
}
}
markStartedStepsCompleted(vm.Pipeline)
}
}

return nil
}

func markStartedStepsCompleted(steps []*plan.Step) {
for _, step := range steps {
if step.MarkedStarted() {
step.MarkCompleted()
}
}
}

func (r *Migration) deletePopulatorPVCs(vm *plan.VMStatus) (err error) {
if r.builder.SupportsVolumePopulators() {
err = r.kubevirt.DeletePopulatedPVCs(vm)
Expand Down

0 comments on commit 663db1e

Please sign in to comment.