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 10, 2024
1 parent c782e11 commit 7c2ed78
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)
}
}

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)
}
}

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),
}
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 {
/// virt-v2v transfers one disk at a time
return 1
} else {
// CDI transfers the disks in parallel by different pods
return len(vm.Disks)
}
}

// 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 7c2ed78

Please sign in to comment.