pub struct VmConfig {Show 18 fields
pub name: String,
pub namespace: String,
pub kernel: PathBuf,
pub initramfs: Option<PathBuf>,
pub root_disk: Option<PathBuf>,
pub data_disk: Option<PathBuf>,
pub seed_iso: Option<PathBuf>,
pub cpus: usize,
pub memory_mb: usize,
pub networks: Vec<NetworkAttachment>,
pub shared_dirs: Vec<SharedDir>,
pub serial_log: PathBuf,
pub cmdline: Option<String>,
pub netns: Option<String>,
pub vsock: bool,
pub machine_id: Option<Vec<u8>>,
pub efi_variable_store: Option<PathBuf>,
pub rosetta: bool,
}Expand description
Everything needed to boot a VM.
Two boot modes are supported:
Initramfs boot (fast, stateless):
Set kernel + initramfs + cmdline + shared_dirs. Leave root_disk
and seed_iso as None. Config delivered via VirtioFS shared directories.
The initramfs IS the root filesystem (unpacked into RAM by the kernel).
Cloud-init boot (traditional, disk-based):
Set kernel + root_disk + seed_iso. Cloud-init reads its config from
the seed ISO (NoCloud datasource). Requires a base disk image.
Fields§
§name: StringUnique name for this VM.
namespace: StringNamespace (logical grouping, e.g., stack name).
kernel: PathBufPath to the kernel image.
initramfs: Option<PathBuf>Path to initramfs (required for initramfs boot, optional for cloud-init boot).
root_disk: Option<PathBuf>Path to the root disk image (None for stateless initramfs boot).
data_disk: Option<PathBuf>Path to additional data disk (optional).
seed_iso: Option<PathBuf>Path to cloud-init seed ISO (None for initramfs boot with VirtioFS config).
cpus: usizeNumber of vCPUs.
memory_mb: usizeMemory in megabytes.
networks: Vec<NetworkAttachment>Network attachments (L2 switch ports or TAP devices).
Shared directories (host → guest via VirtioFS).
serial_log: PathBufPath to serial console log file.
cmdline: Option<String>Kernel command line arguments (optional — platform-specific defaults used if None).
netns: Option<String>Linux network namespace to run the VM in (optional).
When set, the VMM process is spawned inside ip netns exec <netns>.
vsock: boolEnable vsock device for host-guest communication.
machine_id: Option<Vec<u8>>Persistent machine identifier (opaque bytes, driver-specific).
efi_variable_store: Option<PathBuf>Path to EFI variable store for UEFI boot (optional).
rosetta: boolEnable Rosetta translation layer (macOS only, Apple Silicon).