Skip to content

Commit c51e08c

Browse files
committed
docs(snapshot): document version_map caveats
There is some usability issues due to how versioning is implemented in relation with the snapshot versioning feature. How this is exhibited is in two ways: 1. When running `firecracker --describe-snapshot SNAPSHOT`. This will return the version of firecracker that introduced that snapshot version, which may be different from the firecracker version is was taken with. 2. When requesting a `version` in the `/snapshot/create` HTTP API. Again, this has to be the version of firecracker that introduced the snapshot version, not the firecracker version. Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
1 parent 063ed18 commit c51e08c

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

docs/snapshotting/snapshot-support.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,24 @@ the snapshot.
293293
dirtied page bitmap and marks all pages clean (from a diff snapshot point
294294
of view).
295295
- If a `version` is specified, the new snapshot is saved at that version,
296-
otherwise it will be saved at the same version of the running Firecracker.
297-
The version is only used for the microVM state file as it contains internal
298-
state structures for device emulation, vCPUs and others that can change
299-
their format from a Firecracker version to another. Versioning is not
300-
required for the block and memory files. The separate block device file
301-
components of the snapshot have to be handled by the user.
296+
otherwise it will be saved at the latest snapshot version of the running
297+
Firecracker. The version is only used for the microVM state file as it
298+
contains internal state structures for device emulation, vCPUs and others
299+
that can change their format from a Firecracker version to another.
300+
Versioning is not required for the block and memory files.
302301

303302
- _on failure_: no side-effects.
304303

304+
**Notes**:
305+
306+
- The separate block device file components of the snapshot have to be handled
307+
by the user.
308+
- If specified, `version` must match the firecracker version that introduced a
309+
snapshot version, which may differ from the running Firecracker version. For
310+
example, if you are running on `1.1.2` and want to target version `1.0.4`, you
311+
should specify `1.0.0`. Not specifying `version` uses the latest snapshot
312+
version available to that version.
313+
305314
#### Creating diff snapshots
306315

307316
For creating a diff snapshot, you should use the same API command, but with

src/vmm/src/version_map.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ lazy_static! {
6363

6464
/// Static instance used for creating a 1:1 mapping between Firecracker release version
6565
/// and snapshot data format version.
66+
/// !CAVEAT!
67+
/// This map is supposed to be strictly one-to-one (i.e. bijective) because
68+
/// describe-snapshot inverts it to look up the release that matches the
69+
/// snapshot version. If two version map to the snap_version, the results
70+
/// are non-deterministic.
71+
/// This means
72+
/// - Do not insert patch releases here.
73+
/// - Every minor version should be represented here.
74+
/// - When requesting a `target_version`, these are the versions we expect.
6675
pub static ref FC_VERSION_TO_SNAP_VERSION: HashMap<String, u16> = {
6776
let mut mapping = HashMap::new();
6877
#[cfg(not(target_arch = "aarch64"))]

0 commit comments

Comments
 (0)