pub struct InstanceSpec {Show 24 fields
pub box_id: String,
pub vcpus: u8,
pub memory_mib: u32,
pub rootfs: RootfsSource,
pub block_devices: Vec<RawBlockDevice>,
pub exec_socket_path: PathBuf,
pub pty_socket_path: PathBuf,
pub attest_socket_path: PathBuf,
pub port_forward_socket_path: PathBuf,
pub fs_mounts: Vec<FsMount>,
pub entrypoint: Entrypoint,
pub ksm: bool,
pub snapshot_mem_file: Option<String>,
pub snapshot_sock: Option<String>,
pub restore_from: Option<String>,
pub console_output: Option<PathBuf>,
pub workdir: String,
pub tee_config: Option<TeeInstanceConfig>,
pub port_map: Vec<String>,
pub user: Option<String>,
pub network: Option<NetworkInstanceConfig>,
pub disable_tsi: bool,
pub resource_limits: ResourceLimits,
pub log_config: LogConfig,
}Expand description
Complete configuration for a VM instance.
Serialized and passed to the shim subprocess, which uses it to configure and start the VM via the underlying hypervisor.
Fields§
§box_id: StringUnique identifier for this box instance
vcpus: u8Number of vCPUs (platform default: 1 on Windows, 2 elsewhere)
memory_mib: u32Memory in MiB (default: 512)
rootfs: RootfsSourceRoot filesystem transport and backing path.
block_devices: Vec<RawBlockDevice>Additional raw block devices, attached after any block-backed root.
exec_socket_path: PathBufPath to the Unix socket for exec communication
pty_socket_path: PathBufPath to the Unix socket for PTY communication
attest_socket_path: PathBufPath to the Unix socket for TEE attestation communication
port_forward_socket_path: PathBufPath to the Unix socket for CRI port-forward control
fs_mounts: Vec<FsMount>Filesystem mounts (virtio-fs shares)
entrypoint: EntrypointGuest agent entrypoint
ksm: boolMark guest memory KSM-mergeable (host page dedup across same-image VMs; Linux 6.4+, requires /sys/kernel/mm/ksm/run=1 on the host).
snapshot_mem_file: Option<String>Snapshot-fork (per-VM): file-backed guest RAM path. When set (with
snapshot_sock), this VM boots as a snapshot TEMPLATE — guest RAM is
file-backed so it can be snapshotted on demand.
snapshot_sock: Option<String>Snapshot-fork (per-VM): unix socket on which libkrun serves snapshot requests for this template VM.
restore_from: Option<String>Snapshot-fork (per-VM): when set (with snapshot_mem_file), this VM is a
RESTORE — it resumes the snapshotted template from this state file with
MAP_PRIVATE CoW of the RAM file, instead of cold-booting. This is the
per-VM seam that lets one process fork many VMs (the pool / fork daemon),
which a process-global KRUN_RESTORE_FROM env cannot express.
console_output: Option<PathBuf>Optional console output file path
workdir: StringWorking directory inside the VM
tee_config: Option<TeeInstanceConfig>TEE configuration (None for standard VM)
port_map: Vec<String>TSI port mappings: [“host_port:guest_port”, …]
user: Option<String>User to run as inside the VM (from OCI USER directive). Format: “uid”, “uid:gid”, “user”, or “user:group”
network: Option<NetworkInstanceConfig>Network configuration for virtio-net networking. None = TSI mode (default), Some = virtio-net mode (passt on Linux, gvproxy on macOS).
disable_tsi: boolDisable TSI socket interception while retaining explicit vsock IPC.
resource_limits: ResourceLimitsResource limits (PID limits, CPU pinning, ulimits, cgroup controls).
log_config: LogConfigLogging driver config. The shim runs the log processor for the box’s
lifetime (so detached run -d logs aren’t truncated when the CLI exits).
Trait Implementations§
Source§impl Clone for InstanceSpec
impl Clone for InstanceSpec
Source§fn clone(&self) -> InstanceSpec
fn clone(&self) -> InstanceSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more