Skip to content

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Aug 11, 2025

Implement the suggestions from #4523 to give a cleaner API for the
snapshot module. Conceptually, the change is that we now store the thing
we are snapshotting inside of the Snapshot struct.
Implementation-wise, this allows us to deserialize the snapshot data in
a single pass (instead of having to read it twice, once for
deserialization and once for CRC validation), which means we do not have
to first query the snapshot file for the size of the snapshot.

Closes #4691, #4523, #5195

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

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@codecov
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.32%. Comparing base (b9b3432) to head (4d18e27).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/snapshot-editor/src/info.rs 0.00% 9 Missing ⚠️
src/snapshot-editor/src/utils.rs 0.00% 5 Missing ⚠️
src/snapshot-editor/src/edit_vmstate.rs 25.00% 3 Missing ⚠️
src/vmm/src/snapshot/mod.rs 92.68% 3 Missing ⚠️
src/firecracker/src/main.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5355      +/-   ##
==========================================
+ Coverage   82.31%   82.32%   +0.01%     
==========================================
  Files         265      265              
  Lines       30645    30585      -60     
==========================================
- Hits        25224    25179      -45     
+ Misses       5421     5406      -15     
Flag Coverage Δ
5.10-c5n.metal 82.29% <69.35%> (-0.04%) ⬇️
5.10-m5n.metal 82.28% <69.35%> (-0.04%) ⬇️
5.10-m6a.metal 81.57% <69.35%> (-0.04%) ⬇️
5.10-m6g.metal 78.88% <66.66%> (-0.05%) ⬇️
5.10-m6i.metal 82.29% <69.35%> (-0.03%) ⬇️
5.10-m7a.metal-48xl 81.55% <69.35%> (?)
5.10-m7g.metal 78.88% <66.66%> (-0.05%) ⬇️
5.10-m7i.metal-24xl 82.26% <69.35%> (?)
5.10-m7i.metal-48xl 82.26% <69.35%> (?)
5.10-m8g.metal-24xl 78.87% <66.66%> (?)
5.10-m8g.metal-48xl 78.87% <66.66%> (?)
6.1-c5n.metal 82.33% <69.35%> (-0.04%) ⬇️
6.1-m5n.metal 82.32% <69.35%> (-0.04%) ⬇️
6.1-m6a.metal 81.61% <69.35%> (-0.05%) ⬇️
6.1-m6g.metal 78.88% <66.66%> (-0.05%) ⬇️
6.1-m6i.metal 82.32% <69.35%> (-0.03%) ⬇️
6.1-m7a.metal-48xl 81.59% <69.35%> (?)
6.1-m7g.metal 78.87% <66.66%> (-0.06%) ⬇️
6.1-m7i.metal-24xl 82.34% <69.35%> (?)
6.1-m7i.metal-48xl 82.34% <69.35%> (?)
6.1-m8g.metal-24xl 78.87% <66.66%> (?)
6.1-m8g.metal-48xl 78.87% <66.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Aug 11, 2025
@roypat roypat force-pushed the rustify branch 2 times, most recently from 10fe1ac to 5360ce0 Compare August 12, 2025 16:49
Manciukic
Manciukic previously approved these changes Aug 18, 2025
@roypat roypat requested a review from bchalios August 18, 2025 11:20
roypat added 3 commits August 18, 2025 12:29
There was a typo in the output of the remove register operation. Fix it.

Signed-off-by: Patrick Roy <[email protected]>
Have snapshot-editor always create a snapshot at the current version. We
cannot load snapshots that have a different snapshot version than is
supported by the running binary anyway (because strongly-typed
deserialization would fail), so we statically know that the `version`
parameter to `save_vmstate` is always `SNAPSHOT_VERSION`.

Signed-off-by: Patrick Roy <[email protected]>
Implement the suggestions from firecracker-microvm#4523 to give a cleaner API for the
snapshot module. Conceptually, the change is that we now store the thing
we are snapshotting inside of the `Snapshot` struct.
Implementation-wise, this allows us to deserialize the snapshot data in
a single pass (instead of having to read it twice, once for
deserialization and once for CRC validation), which means we do not have
to first query the snapshot file for the size of the snapshot.

Closes firecracker-microvm#4691, firecracker-microvm#4523, firecracker-microvm#5195

Signed-off-by: Patrick Roy <[email protected]>
@bchalios bchalios enabled auto-merge (rebase) August 18, 2025 11:57
@bchalios bchalios merged commit e7504ae into firecracker-microvm:main Aug 18, 2025
6 of 7 checks passed
@roypat roypat mentioned this pull request Aug 18, 2025
9 tasks
@kalyazin kalyazin mentioned this pull request Oct 1, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants