pub struct VmControl { /* private fields */ }Expand description
Cloneable handle for live VM resource control.
Obtained through Vm::control_handle before enter(); background
threads use it to drive live resizes while the VM runs. Memory resize is
backed by virtio-mem and only available when the machine reserved capacity
with max_memory_mib.
Implementations§
Source§impl VmControl
impl VmControl
Sourcepub fn memory_resize_supported(&self) -> bool
pub fn memory_resize_supported(&self) -> bool
Whether the running VM can resize memory live.
Sourcepub fn cpu_resize_supported(&self) -> bool
pub fn cpu_resize_supported(&self) -> bool
Whether the running VM can resize its online CPU count live.
Sourcepub fn set_cpu_target(&self, online: u32) -> Option<u32>
pub fn set_cpu_target(&self, online: u32) -> Option<u32>
Ask the guest to converge on online CPUs and enforce that ceiling
host-side. Returns the accepted target (clamped to 1..=possible), or
None when the VM booted without CPU capacity. The guest driver
onlines/offlines asynchronously; poll cpu_state
for convergence — enforcement applies immediately either way.
Sourcepub fn cpu_state(&self) -> Option<VmCpuState>
pub fn cpu_state(&self) -> Option<VmCpuState>
Current CPU sizing, or None when the VM booted without capacity.
Sourcepub fn set_memory_target_mib(&self, total_mib: u64) -> Option<u64>
pub fn set_memory_target_mib(&self, total_mib: u64) -> Option<u64>
Ask the guest to converge on total_mib of usable memory.
Returns the accepted target in MiB (clamped to the boot..max range and
rounded down to hotplug block granularity), or None when the VM
booted without hotplug capacity. The guest plugs/unplugs blocks
asynchronously; poll memory_state for
convergence.
Sourcepub fn memory_state(&self) -> Option<VmMemoryState>
pub fn memory_state(&self) -> Option<VmMemoryState>
Current memory sizing, or None when the VM booted without capacity.