Skip to content

Commit

Permalink
vsphere: virt-v2v transfers disks sequentially
Browse files Browse the repository at this point in the history
when scheduling migrations to accommodate the controller_max_vm_inflight
setting for vSphere, we didn't take into account that disks are
transferred sequentially by virt-v2v (as opposed to CDI that transfers
them in parallel by different pods). This lead to performance
degregeration since could have triggered more migrations, in case of
migrations of multi-disk VMs, simultaneously without exceeding the value
of controller_max_vm_inflight. This is fixed by setting the cost of each
VM for which the disks are transferred by virt-v2v to 1.

Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Jun 9, 2024
1 parent 4b425e4 commit 62d9b09
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/controller/plan/scheduler/vsphere/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (r *Scheduler) buildInFlight() (err error) {
return
}
if vmStatus.Running() {
r.inFlight[vm.Host] += len(vm.Disks)
r.inFlight[vm.Host] += r.cost(vm)

Check warning on line 110 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L110

Added line #L110 was not covered by tests
}
}

Expand Down Expand Up @@ -148,7 +148,7 @@ func (r *Scheduler) buildInFlight() (err error) {
}
return err
}
r.inFlight[vm.Host] += len(vm.Disks)
r.inFlight[vm.Host] += r.cost(vm)

Check warning on line 151 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L151

Added line #L151 was not covered by tests
}
}

Expand All @@ -169,14 +169,24 @@ func (r *Scheduler) buildPending() (err error) {
if !vmStatus.MarkedStarted() && !vmStatus.MarkedCompleted() {
pending := &pendingVM{
status: vmStatus,
cost: len(vm.Disks),
cost: r.cost(vm),

Check warning on line 172 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L172

Added line #L172 was not covered by tests
}
r.pending[vm.Host] = append(r.pending[vm.Host], pending)
}
}
return
}

func (r *Scheduler) cost(vm *model.VM) int {
if el9, _ := r.Plan.VSphereUsesEl9VirtV2v(); el9 {

Check warning on line 181 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L180-L181

Added lines #L180 - L181 were not covered by tests
/// virt-v2v transfers one disk at a time
return 1
} else {

Check warning on line 184 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L183-L184

Added lines #L183 - L184 were not covered by tests
// CDI transfers the disks in parallel by different pods
return len(vm.Disks)

Check warning on line 186 in pkg/controller/plan/scheduler/vsphere/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/scheduler/vsphere/scheduler.go#L186

Added line #L186 was not covered by tests
}
}

// Return a map of all the VMs that could be scheduled
// based on the available host capacities.
func (r *Scheduler) schedulable() (schedulable map[string][]*pendingVM) {
Expand Down

0 comments on commit 62d9b09

Please sign in to comment.