-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Drop support for forward compatibility #4194
Drop support for forward compatibility #4194
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4194 +/- ##
==========================================
- Coverage 82.95% 82.93% -0.02%
==========================================
Files 221 221
Lines 28415 28231 -184
==========================================
- Hits 23572 23414 -158
+ Misses 4843 4817 -26
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
097d0f7
to
1378cd4
Compare
1378cd4
to
6a820e6
Compare
I think we might also want to remove firecracker/src/firecracker/src/main.rs Lines 537 to 551 in 9b0e03a
|
Why remove it? I think this will be reworked once we implement the new snapshot versioning schema. Once we do that work, each Firecracker version will declare support for a single |
Mh, to me this output always read as "we can create snapshots for these firecracker versions". I guess if it also means "we can restore from these" then its indeed not redundant. On the other hand, it just prints every firecracker version since we introduced snapshotting, which is completely wrong since there has been multiple non-compatible changes to the snapshot format since then. Do we plan to introduce the new versioning scheme with this release? If yes we can keep it as is (it'll get fixed when the new scheme gets introduced, as you say), but if no I'd rather we remove it (or fix it for the current version scheme). |
Did you maybe mean that we should remove this function: firecracker/src/firecracker/src/main.rs Lines 513 to 524 in 9b0e03a
Then I agree. |
Oh, yes, so sorry! That's the one I was looking at in my editor, seems I failed at cross-referencing with GitHub |
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 we can also do
diff --git a/src/snapshot/src/lib.rs b/src/snapshot/src/lib.rs
index 8b394c4a4..9dfea9a3d 100644
--- a/src/snapshot/src/lib.rs
+++ b/src/snapshot/src/lib.rs
@@ -74,8 +74,6 @@ struct SnapshotHdr {
pub struct Snapshot {
hdr: SnapshotHdr,
version_map: VersionMap,
- // Required for serialization.
- target_version: u16,
}
// Parse a magic_id and return the format version.
@@ -93,11 +91,10 @@ fn build_magic_id(format_version: u16) -> u64 {
impl Snapshot {
/// Creates a new instance which can only be used to save a new snapshot.
- pub fn new(version_map: VersionMap, target_version: u16) -> Snapshot {
+ pub fn new(version_map: VersionMap) -> Snapshot {
Snapshot {
version_map,
hdr: SnapshotHdr::default(),
- target_version,
}
}
@@ -194,7 +191,7 @@ impl Snapshot {
O: Versionize + Debug,
{
self.hdr = SnapshotHdr {
- data_version: self.target_version,
+ data_version: self.version_map.latest_version(),
};
let format_version_map = Self::format_version_map();
@@ -216,7 +213,7 @@ impl Snapshot {
// Serialize the object using the state version map.
object
- .serialize(&mut writer, &self.version_map, self.target_version)
+ .serialize(&mut writer, &self.version_map, self.version_map.latest_version())
.map_err(Error::Versionize)?;
writer
.flush()
diff --git a/src/vmm/src/persist.rs b/src/vmm/src/persist.rs
index 7002426b4..d502cc7f3 100644
--- a/src/vmm/src/persist.rs
+++ b/src/vmm/src/persist.rs
@@ -209,8 +209,6 @@ pub fn create_snapshot(
params: &CreateSnapshotParams,
version_map: VersionMap,
) -> Result<(), CreateSnapshotError> {
- let snapshot_data_version = version_map.latest_version();
-
let microvm_state = vmm
.save_state(vm_info)
.map_err(CreateSnapshotError::MicrovmState)?;
@@ -218,7 +216,6 @@ pub fn create_snapshot(
snapshot_state_to_file(
µvm_state,
¶ms.snapshot_path,
- snapshot_data_version,
version_map,
)?;
@@ -230,7 +227,6 @@ pub fn create_snapshot(
fn snapshot_state_to_file(
microvm_state: &MicrovmState,
snapshot_path: &Path,
- snapshot_data_version: u16,
version_map: VersionMap,
) -> Result<(), CreateSnapshotError> {
use self::CreateSnapshotError::*;
@@ -241,7 +237,7 @@ fn snapshot_state_to_file(
.open(snapshot_path)
.map_err(|err| SnapshotBackingFile("open", err))?;
- let mut snapshot = Snapshot::new(version_map, snapshot_data_version);
+ let mut snapshot = Snapshot::new(version_map);
snapshot
.save(&mut snapshot_file, microvm_state)
.map_err(SerializeMicrovmState)?;
and then fix up the tests accordingly
Would you mind if we did this when we redefine the Snapshot structure, with the new versioning schema? At the moment, nothing actually uses The reason why I want to avoid doing this now, is because this code is used by the snapshot_editor tool, to edit snapshots. It might edit older snapshots, so the |
Ahh, didnt see that. Yeah, that's totally fine |
b578692
to
87f0d81
Compare
Forward compatibility refers to the ability of a Firecracker binary to create snapshots for older versions of Firecracker. We have found this feature to not be useful, while it increases code and testing complexity. This commit removes forward compatibility support from Firecracker binary. Signed-off-by: Babis Chalios <bchalios@amazon.es>
We do not need these any more, because we will never serialize to older versions of Firecracker snapshots. Also, remove various unit tests that were checking for failures depending on which version we are serializing to. This clean up in the tests is not complete. There will be a general re-structure once we fix the snapshot versioning format. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Previously, using the '--version' flag of the Firecracker binary would print the Firecracker version and the supported snapshot versions. Change the behaviour to only print the Firecracker version. Signed-off-by: Babis Chalios <bchalios@amazon.es>
We dropped support for Firecracker snapshots forward compatibility. Clean up the tests related to this functionality. Mainly remove tests that directly use the removed feature and re-organize some of the code to adapt to the now missing functionality. Signed-off-by: Babis Chalios <bchalios@amazon.es>
629aff2
to
e960d8d
Compare
Changes
Removes forward compatibility support from Firecracker binary.
Reason
Forward compatibility refers to the ability of a Firecracker binary to create snapshots for older versions of Firecracker.
We have found this feature to not be useful, while it increases code and testing complexity.
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
CHANGELOG.md
.TODO
s link to an issue.rust-vmm
.