Skip to main content

VmControl

Struct VmControl 

Source
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

Source

pub fn memory_resize_supported(&self) -> bool

Whether the running VM can resize memory live.

Source

pub fn cpu_resize_supported(&self) -> bool

Whether the running VM can resize its online CPU count live.

Source

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.

Source

pub fn cpu_state(&self) -> Option<VmCpuState>

Current CPU sizing, or None when the VM booted without capacity.

Source

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.

Source

pub fn memory_state(&self) -> Option<VmMemoryState>

Current memory sizing, or None when the VM booted without capacity.

Trait Implementations§

Source§

impl Clone for VmControl

Source§

fn clone(&self) -> VmControl

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V