Skip to content

Commit

Permalink
Don't cleanup forklift entities on remote cluster
Browse files Browse the repository at this point in the history
When MTV is not installed on the remote OCP cluster and we try to
cleanup we won't succeed. This patch won't try to remove or edit
forklift entities, as if MTV doesn't exist there, it will fail - causing
the plan to fail.

Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 committed May 1, 2024
1 parent 9c4e0a6 commit 244a315
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,10 @@ func (r *Migration) cleanup(vm *plan.VMStatus, failOnErr func(error) bool) error
if err := r.kubevirt.DeleteHookJobs(vm); failOnErr(err) {
return err
}
if err := r.destinationClient.DeletePopulatorDataSource(vm); failOnErr(err) {
return err
if r.Plan.Provider.Destination.IsHost() {
if err := r.destinationClient.DeletePopulatorDataSource(vm); failOnErr(err) {
return err
}
}
if err := r.kubevirt.DeletePopulatorPods(vm); failOnErr(err) {
return err
Expand Down Expand Up @@ -829,10 +831,12 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) {
}
}
// set ownership to populator Crs
err = r.destinationClient.SetPopulatorCrOwnership()
if err != nil {
err = liberr.Wrap(err)
return
if r.Plan.Provider.Destination.IsHost() {
err = r.destinationClient.SetPopulatorCrOwnership()
if err != nil {
err = liberr.Wrap(err)
return
}
}
// set ownership to populator pods
err = r.kubevirt.SetPopulatorPodOwnership(vm)
Expand Down

0 comments on commit 244a315

Please sign in to comment.