-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add vCPUs to VMM via new endpoint #4638
Add vCPUs to VMM via new endpoint #4638
Conversation
d85f45c
to
bf738f5
Compare
5c7dd7a
to
55d7a01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks very good already, nice job! I left some in-line comments about some specific part that can be improved. Some high level comments:
Every project has some slightly different rules and preferences about commit histories in pull requests, but in Firecracker we to prefer not have commits that fix/reformat code introduced in earlier commits. For example, the formatting bf738f5 should be squashed into the commit that introduces the code you're reformatting here. As a rule of thumb, whenever you're just fixing some CI failure, squash the change into the commit that introduced the issue you're fixing.
Beyond that, in this PR I would structure the commits as follows:
- a commit that refactors the seccomp filter handling so that they are stored in
Vmm
- a commit that introduces the API endpoint, including a stub handler in
rpc_interface.rs
(if you want, you can include the unit tests in this one, or add a separate commit for them) - a commit that implements
Vmm::hotplug_vcpus
(with or without the unit tests, again up to you)
I don't really have any fixed rules as for how I came up with that, but generally I try to have my commits be a single logical unit of code that is still independently useful. That's why I would put the seccomp refactor into a commit separate from the hotplug_vcpus
function (as they're two units of code to me, a refactor + a feature), but I would combine your first two commits that introduce the API endpoints in two steps (because having the endpoint without parsing the json would feel a bit too fine-grained to me). But it's not an exact science, so feel free to deviate from whatever I'm suggesting if you disagree with it!
Lastly, could you drop Pablo's commits from this PR? We can just rebase the feature branch onto main to pick them up :)
Thanks for the feedback, still trying to fix some issues Buildkite is picking up on but will work on this as soon as I'm done with it :) |
cec50cf
to
861ad2c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/vcpu-hotplug #4638 +/- ##
========================================================
- Coverage 82.10% 82.09% -0.01%
========================================================
Files 255 257 +2
Lines 31280 31386 +106
========================================================
+ Hits 25681 25765 +84
- Misses 5599 5621 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
aea2486
to
cc578f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I've left some minor comments, mainly the one about testing that we talked about offline.
d61a486
to
16ae684
Compare
f4f9577
to
10c8399
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well! There's no need to address the comments below, unless you happen to be revisiting the code anyway :)
Holding of on hitting the approve button until @bchalios also had a chance to look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey James, thanks for the PR and apologies for the delayed review. Overall, great work!
I 've left some comments inline. Some of them are open for discussion, e.g. the actual API we should use for this. These things can be changed in subsequent PRs. But I'd love to hear your thoughts.
Others, I 'd like them fixed in this PR. Mainly this includes:
- Fix errors introduced by a commit in the commit that introduced them, rather than later on
- I'd like as to avoid using
as
in favour of explicitinto()
ortry_into().unwrap()
, where applicable.
Also, could you please update the swagger file with the definition of the new API whichever we decide it is.
656c6cf
to
188bd81
Compare
732c718
to
5335ef9
Compare
Create a new endpoint `hotplug` in `parsed_request.rs` and implement basic skeleton of endpoint implementation. Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Add seccompiler filters as a field of the VMM. This is required to ensure that the newly created vCPU threads have the same filters as the currently existing vCPU threads Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Actually add the vCPUS to the VMM via API PUT requests to hotplug endpoint. Must add at least 1 vCPU, and the total number of vCPUs after hotplug must not exceed MAX_SUPPORTED_VCPUS (currently 32). Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
a8819ed
into
firecracker-microvm:feature/vcpu-hotplug
🎉 |
Changes
hotplug
used to request resources on demand (currently only vCPU implemented)hotplug
, the specified number of vCPU threads are added directly to the guest VMM--no-seccomp
optionReason
This is the first step in implementing resource hot plugging via ACPI. Related to feature request #2609.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
PR.
CHANGELOG.md
.TODO
s link to an issue.contribution quality standards.
rust-vmm
.