Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the default setting of CPU requests on vmipods #6374

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

vladikr
Copy link
Member

@vladikr vladikr commented Sep 9, 2021

What this PR does / why we need it:
This PR fixes the default setting of CPU requests on the virt-launcher compute container.
The default vmipods CPU request is being calculated during the pod creation and scales with the number of vCPUS according to the cpu_allocation_ratio (which defaults to 10) setting
This way, the default CPU request of a vmipod , created for a VMI with 1 vCPU, will be 100m.

This PR adds unit and functional tests to verify the correct behavior.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes # rhbz#2002313

Fix the default setting of CPU requests on vmipods

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M labels Sep 9, 2021
…al to vCPUs

Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
@vladikr
Copy link
Member Author

vladikr commented Sep 10, 2021

/cc @rmohr

@jean-edouard
Copy link
Contributor

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jean-edouard

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2021
@@ -858,7 +858,7 @@ func (t *templateService) renderLaunchManifest(vmi *v1.VirtualMachineInstance, t
if vcpus != 0 && cpuAllocationRatio > 0 {
val := float64(vcpus) / float64(cpuAllocationRatio)
vcpusStr := fmt.Sprintf("%g", val)
if val < 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just curious here. How can vcpus be 0? (line 858)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's not provided? Not sure, but it's better to check.

@@ -221,7 +221,7 @@ var _ = Describe("VirtualMachineInstance Mutator", func() {
Expect(vmiSpec.Domain.CPU.Model).To(Equal(""))
}

Expect(vmiSpec.Domain.Resources.Requests.Cpu().String()).To(Equal("100m"))
Expect(vmiSpec.Domain.Resources.Requests.Cpu().IsZero()).To(BeTrue())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we change this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the default will be calculated and normalized according to the cpu allocation ratio.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 14, 2021
@kubevirt-bot kubevirt-bot merged commit 761991a into kubevirt:main Sep 14, 2021
@rmohr
Copy link
Member

rmohr commented Sep 15, 2021

/lgtm

@stu-gott
Copy link
Member

/cherry-pick release-0.44
/cherry-pick release-0.41

@kubevirt-bot
Copy link
Contributor

@stu-gott: new pull request created: #6423

In response to this:

/cherry-pick release-0.44
/cherry-pick release-0.41

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@stu-gott
Copy link
Member

/cherry-pick release-0.41

@kubevirt-bot
Copy link
Contributor

@stu-gott: new pull request created: #6453

In response to this:

/cherry-pick release-0.41

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants