Skip to content

Commit c727cf1

Browse files
committed
api update by KubeVirt Prow build 1985736629997801472
1 parent 1a56b42 commit c727cf1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/v1/types.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,15 @@ func (v *VirtualMachineInstance) IsBootloaderEFI() bool {
572572
v.Spec.Domain.Firmware.Bootloader.EFI != nil
573573
}
574574

575-
// WantsToHaveQOSGuaranteed checks if cpu and memoyr limits and requests are identical on the VMI.
575+
// WantsToHaveQOSGuaranteed checks if cpu and memory limits and requests are identical on the VMI.
576576
// This is the indicator that people want a VMI with QOS of guaranteed
577+
// If memory limit is set but not its corresponding request, we will eventually set request=limit
577578
func (v *VirtualMachineInstance) WantsToHaveQOSGuaranteed() bool {
578579
resources := v.Spec.Domain.Resources
579-
return !resources.Requests.Memory().IsZero() && resources.Requests.Memory().Cmp(*resources.Limits.Memory()) == 0 &&
580-
!resources.Requests.Cpu().IsZero() && resources.Requests.Cpu().Cmp(*resources.Limits.Cpu()) == 0
580+
memoryWantsIt := (resources.Requests.Memory().IsZero() && !resources.Limits.Memory().IsZero()) ||
581+
(!resources.Requests.Memory().IsZero() && resources.Requests.Memory().Cmp(*resources.Limits.Memory()) == 0)
582+
cpuWantsIt := !resources.Requests.Cpu().IsZero() && resources.Requests.Cpu().Cmp(*resources.Limits.Cpu()) == 0
583+
return memoryWantsIt && cpuWantsIt
581584
}
582585

583586
// ShouldStartPaused returns true if VMI should be started in paused state

0 commit comments

Comments
 (0)