pub struct LimitsState {
pub host_ram_mib: u64,
pub mem_size_mib: Option<u64>,
pub running_drives: u32,
pub running_nics: u32,
pub running_pmem: u32,
}Expand description
Cross-field limits that the controller enforces synchronously, before an action is
forwarded to the VMM event loop. These are the upper bounds that the per-field
Raw* → Validated TryFrom conversions cannot enforce because they need the running
machine state (host RAM cap, configured mem_size_mib, running counts).
Per 93-improvements-review.md Phase 2 entry — fix shape “thread BackendCapabilities
into the controller, add MachineConfig::validate_against_host(...) invoked at
dispatch time before the action reaches the VMM event loop”.
Fields§
§host_ram_mib: u64Host RAM (MiB). Defaults to a generous-but-finite value so tests have a fixed
upper bound; production builds set this from the live BackendCapabilities.
mem_size_mib: Option<u64>Most recently configured mem_size_mib. None until the first
PUT /machine-config lands.
running_drives: u32Drives the controller has accepted (≤ MAX_DRIVES = 8).
running_nics: u32Network interfaces accepted (≤ MAX_NICS = 8).
running_pmem: u32pmem devices accepted (≤ MAX_PMEM = 4).
Implementations§
Source§impl LimitsState
impl LimitsState
Sourcepub fn from_host_ram_mib(host_ram_mib: u64) -> Self
pub fn from_host_ram_mib(host_ram_mib: u64) -> Self
Default limits — host RAM caps generously high so that vanilla unit tests keep
passing without injecting a BackendCapabilities mock. Production builds
override host_ram_mib from the live HVF BackendCapabilities snapshot.