firecracker_rs_sdk/models/
snapshot_load_params.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5use super::memory_backend;
6
7/// Defines the configuration used for handling snapshot resume. Exactly one of
8/// the two `mem_*` fields must be present in the body of the request.
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
10pub struct SnapshotLoadParams {
11    /// Enable support for incremental (diff) snapshots
12    /// by tracking dirty guest pages.
13    #[serde(
14        rename = "enable_diff_snapshots",
15        skip_serializing_if = "Option::is_none"
16    )]
17    pub enable_diff_snapshots: Option<bool>,
18
19    /// Path to the file that contains the guest memory to be loaded.
20    /// It is only allowed if `mem_backend` is not present. This parameter has
21    /// been deprecated and it will be removed in future Firecracker release.
22    /// Required: true
23    #[serde(rename = "mem_file_path", skip_serializing_if = "Option::is_none")]
24    pub mem_file_path: Option<PathBuf>,
25
26    /// Configuration for the backend that handles memory load. If this field
27    // is specified, `mem_file_path` is forbidden. Either `mem_backend` or
28    // `mem_file_path` must be present at a time.
29    #[serde(rename = "mem_backend", skip_serializing_if = "Option::is_none")]
30    pub mem_backend: Option<memory_backend::MemoryBackend>,
31
32    /// When set to true, the vm is also resumed
33    /// if the snapshot load is successful.
34    #[serde(rename = "resume_vm", skip_serializing_if = "Option::is_none")]
35    pub resume_vm: Option<bool>,
36
37    /// Path to the file that contains the microVM state to be loaded.
38    /// Required: true
39    #[serde(rename = "snapshot_path")]
40    pub snapshot_path: PathBuf,
41}