pub struct VmSpec {Show 13 fields
pub id: VmId,
pub cpus: u32,
pub memory_mib: u32,
pub boot: BootSpec,
pub disks: Vec<DiskSpec>,
pub nics: Vec<NicSpec>,
pub vsock: Option<VsockSpec>,
pub shares: Vec<ShareSpec>,
pub console: ConsoleSpec,
pub balloon: bool,
pub entropy: bool,
pub dirty_tracking: bool,
pub isolation: IsolationSpec,
}Expand description
Everything a driver needs to boot one VM.
Validate with VmSpec::validate before handing it to a driver; drivers
validate again at VmDriver::boot, so an orchestrator that
forgets still gets Error::InvalidSpec rather than a half-built VM.
Fields§
§id: VmIdThe VM’s identity.
cpus: u32Virtual CPU count, at least 1.
memory_mib: u32Guest memory in MiB, at least 1.
boot: BootSpecHow the guest starts.
disks: Vec<DiskSpec>Block devices, in bus order.
nics: Vec<NicSpec>Network interfaces, in bus order.
vsock: Option<VsockSpec>The vsock device, when the guest should have one.
Shared host directories (virtiofs).
console: ConsoleSpecWhere the guest console goes.
balloon: boolAttach a memory balloon.
entropy: boolAttach an entropy (virtio-rng) device.
dirty_tracking: boolTrack dirty pages so a checkpoint can be incremental.
isolation: IsolationSpecHow the VMM process is confined.
Implementations§
Source§impl VmSpec
impl VmSpec
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks the invariants no driver can repair.
CPU and memory are at least 1; disk ids are plain names (the path-safe
alphabet, wider than VmId’s) and unique; NIC ids and share tags are
non-empty and unique; at most one disk is the root; every MAC is a
non-nil unicast address; every boot, disk and share path is non-empty;
the vsock guest CID is 3 or above.