Skip to main content

SnapshotError

Enum SnapshotError 

Source
#[non_exhaustive]
pub enum SnapshotError {
Show 14 variants QuiesceTimeout, MagicMismatch { found: u64, expected: u64, }, VersionMismatch { found: Version, expected: Version, }, CrcMismatch, TooShort, Incompatible, AtomicCommitFailed(Error), AtomicCommitCrossFs { dest: PathBuf, temp_dir: PathBuf, }, InvalidPath(String), Bitcode(String), SizeLimitExceeded { limit: usize, }, MemoryIo(Error), Io(Error), Capture(String),
}
Expand description

Errors produced by the snapshot subsystem.

Variants and their Display shapes are wire-stable per I-RC-8: the API layer surfaces to_string() verbatim into the fault_message body. Renaming a variant or its message is a compat-suite golden change.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

QuiesceTimeout

A vCPU did not acknowledge the quiesce request within the timeout.

Surfaces as 503 Service Unavailable on PUT /snapshot/create. The save is aborted; the previous on-disk pair (if any) is untouched.

§

MagicMismatch

Snapshot magic mismatch — the file is not a squib-/Firecracker-compatible state file.

Fields

§found: u64

Magic value read from the file header.

§expected: u64

Magic value squib expected (architecture-specific).

§

VersionMismatch

Snapshot version is not loadable by this squib build.

The compat rule mirrors upstream: major must match exactly; minor must be ≤ ours; patch is unrestricted.

Fields

§found: Version

Version embedded in the file.

§expected: Version

Version this squib build emits.

§

CrcMismatch

CRC64 of the file body does not match its trailing checksum.

§

TooShort

The file is shorter than the trailing 8-byte CRC.

§

Incompatible

Snapshot deserializes to a structurally compatible state, but the contents (sysreg subset, GIC blob shape) are from a different VMM.

§

AtomicCommitFailed(Error)

Atomic-commit failed: the temp file wrote successfully but rename(2) did not complete. The previous destination pair (if any) is left untouched.

§

AtomicCommitCrossFs

The user-supplied destination path and the temp-file directory live on different filesystems, so rename(2) could not be atomic.

Pre-flight check; surfaces before any data is written. The remediation is for the operator to point the snapshot at a path on the same filesystem as the temp directory (or vice-versa).

Fields

§dest: PathBuf

User-supplied destination path.

§temp_dir: PathBuf

Directory in which the temp file would have been created.

§

InvalidPath(String)

Operator handed the API a path that did not pass boundary validation (NUL byte, oversized, traversal).

§

Bitcode(String)

bitcode failed to encode or decode the snapshot envelope.

Display matches Self::wire_message so the API server’s fault_message body is byte-equal to the rendered to_string().

§

SizeLimitExceeded

The file is larger than the squib deserialization size limit.

Fields

§limit: usize

The configured limit.

§

MemoryIo(Error)

Memory file write failed (sparse pwrite, full dump, or fsync).

§

Io(Error)

Generic I/O error during state file read/write or fsync.

§

Capture(String)

A host-side capture or restore step failed (HVF call returned an error, MMDS handle was poisoned, etc.). The string is the underlying cause for the fault_message; the variant exists to keep host-FFI failures out of Bitcode and Io (both of which connote different remediations).

Implementations§

Source§

impl SnapshotError

Source

pub fn wire_message(&self) -> String

The exact fault_message body string this error surfaces to the API.

Stable per I-RC-8 — renaming a variant or its Display shape is a compat-suite golden change. Single-source-of-truth: this delegates to Display, so the two cannot drift.

Trait Implementations§

Source§

impl Debug for SnapshotError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SnapshotError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SnapshotError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for SnapshotError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for SnapshotError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more