pub struct InstanceSpec {Show 22 fields
pub box_id: String,
pub vcpus: u8,
pub memory_mib: u32,
pub rootfs_path: PathBuf,
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 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 (default: 2)
memory_mib: u32Memory in MiB (default: 512)
rootfs_path: PathBufPath to the root filesystem
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).
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 moreSource§impl Debug for InstanceSpec
impl Debug for InstanceSpec
Source§impl Default for InstanceSpec
impl Default for InstanceSpec
Source§fn default() -> InstanceSpec
fn default() -> InstanceSpec
Source§impl<'de> Deserialize<'de> for InstanceSpec
impl<'de> Deserialize<'de> for InstanceSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstanceSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstanceSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for InstanceSpec
impl Serialize for InstanceSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for InstanceSpec
impl RefUnwindSafe for InstanceSpec
impl Send for InstanceSpec
impl Sync for InstanceSpec
impl Unpin for InstanceSpec
impl UnsafeUnpin for InstanceSpec
impl UnwindSafe for InstanceSpec
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more