Skip to main content

VmSpec

Struct VmSpec 

Source
pub struct VmSpec {
    pub kernel: Option<PathBuf>,
    pub rootfs: Option<PathBuf>,
    pub rootfs_read_only: Option<bool>,
    pub vcpu_count: Option<u8>,
    pub mem_size_mib: Option<u32>,
    pub boot_args: Option<String>,
    pub rootfs_rate_limit: Option<RateLimiter>,
    pub network_interfaces: Vec<NetworkInterface>,
    pub extra_drives: Vec<DriveSpec>,
    pub vsock: Option<VsockSpec>,
    pub restore_from: Option<SnapshotRef>,
    pub track_dirty_pages: Option<bool>,
}
Expand description

Per-VM configuration override. Every field is optional; None falls back to the provider’s workspace-level default (e.g. FirecrackerConfig).

Use VmSpec::default for cold boot with workspace defaults, or set VmSpec::restore_from to restore from a snapshot instead of cold-booting.

To do a warm-pool handoff — a pre-restored VM that swaps its TAP and IP onto a new tenant — set VmSpec::restore_from with SnapshotRef::network_overrides populated. Firecracker 1.10+ supports this; 1.6 rejects it.

Fields§

§kernel: Option<PathBuf>

Kernel image path. None = use workspace default.

§rootfs: Option<PathBuf>

Rootfs image path. None = use workspace default.

§rootfs_read_only: Option<bool>

Mount rootfs read-only. None = use workspace default.

§vcpu_count: Option<u8>

vCPU count override.

§mem_size_mib: Option<u32>

Memory size in MiB override.

§boot_args: Option<String>

Kernel command-line override.

§rootfs_rate_limit: Option<RateLimiter>

Rate limit applied to the rootfs drive.

§network_interfaces: Vec<NetworkInterface>

Network interfaces to attach pre-boot. Firecracker requires these to be configured before InstanceStart. Empty by default — the VM has no network unless explicitly set.

§extra_drives: Vec<DriveSpec>

Additional drives beyond rootfs (e.g. workspace volume, sidecar, nix store). Empty by default. Configured via PUT /drives/<drive_id>.

§vsock: Option<VsockSpec>

Vsock device. When Some, configured via PUT /vsock before InstanceStart. Required for guest↔host RPC channels (e.g. talking to a guest sidecar).

§restore_from: Option<SnapshotRef>

If set, the VM boots from a snapshot via PUT /snapshot/load instead of cold-booting. The spec’s kernel, rootfs, vcpu_count, mem_size_mib, boot_args, network_interfaces, extra_drives, and vsock are ignored when restoring (the snapshot encodes its own machine config). Use SnapshotRef::network_overrides to swap network interfaces on restore.

§track_dirty_pages: Option<bool>

Track dirty pages during execution — required to later capture diff snapshots. None = enabled (FC’s safer default for snapshot-friendly workloads).

Trait Implementations§

Source§

impl Clone for VmSpec

Source§

fn clone(&self) -> VmSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VmSpec

Source§

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

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

impl Default for VmSpec

Source§

fn default() -> VmSpec

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.