Skip to content

Drop versionize support, substitute with serde #4230

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

Merged
merged 11 commits into from
Jan 15, 2024
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`VcpuExit::IoOut`. The average for these VM exits is not emitted since
it can be deduced from the available emitted metrics.

### Changed

- [#4230](https://github.com./firecracker-microvm/firecracker/pull/4230):
Changed microVM snapshot format version strategy. Firecracker snapshot format
now has a version that is independent of Firecracker version. The current
version of the snapshot format is v1.0.0. From now on, the Firecracker binary
will define the snapshot format version it supports and it will only be able
to load snapshots with format that is backwards compatible with that version.
Users can pass the `--snapshot-version` flag to the Firecracker binary to see
its supported snapshot version format. This change renders all previous
Firecracker snapshots (up to Firecracker version v1.6.0) incompatible with
the current Firecracker version.

## [v1.6.0]

### Added
Expand Down
57 changes: 19 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ panic = "abort"
lto = true

[patch.crates-io]
kvm-bindings = { git = "https://github.com./firecracker-microvm/kvm-bindings", tag = "v0.7.0-1", features = ["fam-wrappers"] }
kvm-bindings = { git = "https://github.com./firecracker-microvm/kvm-bindings", tag = "v0.7.0-2", features = ["fam-wrappers"] }
Binary file removed docs/images/version_graph.png
Binary file not shown.
Binary file removed docs/images/versionize.png
Binary file not shown.
55 changes: 7 additions & 48 deletions docs/snapshotting/snapshot-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,41 +175,13 @@ The snapshot functionality is still in developer preview due to the following:

## Snapshot versioning

The Firecracker snapshotting implementation offers support for snapshot versioning
(`cross-version snapshots`) in the following contexts:

- Saving snapshots at older versions

**DEPRECATED**: This feature is deprecated starting with version 1.5.0. It
will be removed in a subsequent release. After dropping support, Firecracker
will be able to create snapshots only for the version supported by the
Firecracker binary that launched the microVM and not for older versions.

This refers to being able to create a snapshot with any version in the
`[N, N + o]` interval, while running Firecracker version `N+o`.

The possibility to save snapshots at older versions might not be offered by
all Firecracker releases. Depending on the features that it introduces, a new
Firecracker release `v` might drop the possibility to save snapshots at any
versions older than `v`.

For example Firecracker v1.0 and v1.1 adds support for some additional virtio
features (e.g. notification suppression). These features lead the guest
drivers to behave in a very specific way and as a consequence the Firecracker
devices have to respond accordingly. As a result, the snapshots that are
created while these features are in use will not be backwards compatible with
previous versions of Firecracker since the devices that come with these older
versions do not behave in a way that’s compatible with the snapshotted guest
drivers.

The list of versions that break snapshot backwards compatibility: `1.0`, `1.1`
- Loading snapshots from older versions (being able to load a snapshot created
by any Firecracker version in the `[N, N + o]` interval, in a Firecracker
version `N+o`).

The design supports an unlimited number of versions, the value of `o` (maximum number
of older versions that we can restore from / save a snapshot to, from the current
version) will be defined later.
The microVM state snapshot file uses a data format that has a version in the
form of `MAJOR.MINOR.PATCH`. Each Firecracker binary supports a fixed version
of the snapshot data format. When creating a snapshot, Firecracker will use the
supported data format version. When loading snapshots, Firecracker will check
that the snapshot version is compatible with the version it supports. More
information about the snapshot data format and details about snapshot data
format versions can be found at [versioning](./versioning.md).

## Snapshot API

Expand Down Expand Up @@ -294,7 +266,6 @@ curl --unix-socket /tmp/firecracker.socket -i \
"snapshot_type": "Full",
"snapshot_path": "./snapshot_file",
"mem_file_path": "./mem_file",
"version": "1.0.0"
}'
```

Expand Down Expand Up @@ -323,24 +294,13 @@ the snapshot. If they exist, the files will be truncated and overwritten.
- If diff snapshots were enabled, the snapshot creation resets then the
dirtied page bitmap and marks all pages clean (from a diff snapshot point
of view).
- If a `version` is specified, the new snapshot is saved at that version,
otherwise it will be saved at the latest snapshot version of the running
Firecracker. The version is only used for the microVM state file as it
contains internal state structures for device emulation, vCPUs and others
that can change their format from a Firecracker version to another.
Versioning is not required for the block and memory files.

- _on failure_: no side-effects.

**Notes**:

- The separate block device file components of the snapshot have to be handled
by the user.
- If specified, `version` must match the firecracker version that introduced a
snapshot version, which may differ from the running Firecracker version. For
example, if you are running on `1.1.2` and want to target version `1.0.4`, you
should specify `1.0.0`. Not specifying `version` uses the latest snapshot
version available to that version.

#### Creating diff snapshots

Expand All @@ -358,7 +318,6 @@ curl --unix-socket /tmp/firecracker.socket -i \
"snapshot_type": "Diff",
"snapshot_path": "./snapshot_file",
"mem_file_path": "./mem_file",
"version": "1.0.0"
}'
```

Expand Down
Loading