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 guest memory setting #8367

Merged
merged 1 commit into from Aug 26, 2022
Merged

Conversation

vladikr
Copy link
Member

@vladikr vladikr commented Aug 25, 2022

What this PR does / why we need it:

It appears that we are incorrectly setting the guest memory to equal resources.limits.memory.
VMI specs that don't explicitly provide a value for domain.memory.guest
and provide different values for resources requests and limits will be converted to a domain definition where guest memory equals resources.limits.memory.

Special notes for your reviewer:
From my recollection, we used to have a vmi mutator webhook that set the correct value, but I don't see it right now.

Release note:

fix the guest memory conversion by setting it to resources.requests.memory when guest memory is not explicitly provided 

@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 Aug 25, 2022
@vladikr
Copy link
Member Author

vladikr commented Aug 25, 2022

/cc @rmohr @davidvossel

Copy link
Member

@xpivarc xpivarc left a comment

Choose a reason for hiding this comment

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

This makes sense and will also help we cases when we need to provide both requests and limits.
I have one suggestion on how to simplify the test.

Expect(domXml).To(ContainSubstring(expectedMemoryXMLStr))

},
Entry("provided by domain spec directly", pointer.Int(512), nil, nil),
Copy link
Member

Choose a reason for hiding this comment

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

This could be simpler by using options. WithGuestMemory, WithLimitMemory WithResourceMemory. You just need to use New rather than NewAlpine to not get the default.

@@ -624,8 +681,10 @@ var _ = Describe("[sig-compute]Configurations", func() {
Context("[rfe_id:140][crit:medium][vendor:cnv-qe@redhat.com][level:component]with diverging memory limit from memory request and no guest memory", func() {
It("[test_id:3115]should show the memory limit inside the VMI", func() {
vmi := libvmi.NewCirros()
vmi.Spec.Domain.Resources.Limits = kubev1.ResourceList{
kubev1.ResourceMemory: resource.MustParse("256Mi"),
vmi.Spec.Domain.Resources = v1.ResourceRequirements{
Copy link
Member

Choose a reason for hiding this comment

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

This is overriding the memory, do we want it? Let's change the name if we do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, yeah.
Changed

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

xpivarc commented Aug 26, 2022

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xpivarc

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 Aug 26, 2022
@vladikr
Copy link
Member Author

vladikr commented Aug 26, 2022

/retest

Copy link
Member

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2022
@kubevirt-bot
Copy link
Contributor

kubevirt-bot commented Aug 26, 2022

@vladikr: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-fossa db05592 link false /test pull-kubevirt-fossa

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. I understand the commands that are listed here.

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

4 participants