Skip to main content

VmConfig

Struct VmConfig 

Source
pub struct VmConfig {
Show 15 fields pub schema_version: u32, pub name: String, pub generation_id: Option<Uuid>, pub memory_mib: u64, pub vcpus: u16, pub acceleration: Acceleration, pub firmware: Firmware, pub software_tpm2: bool, pub disk: DiskConfig, pub install_media: Option<PathBuf>, pub network: NetworkConfig, pub audio: AudioMode, pub pointer_device: PointerDevice, pub usb_devices: Vec<UsbHostDevice>, pub shares: Vec<DirectoryShare>,
}
Expand description

A persistent virtual machine definition.

Fields§

§schema_version: u32

Configuration schema version.

§name: String

User-visible and filesystem-safe VM name.

§generation_id: Option<Uuid>

Stable generation identifier exposed to the guest.

§memory_mib: u64

Guest RAM in mebibytes.

§vcpus: u16

Number of virtual CPUs.

§acceleration: Acceleration

Preferred accelerator.

§firmware: Firmware

Boot firmware selection.

§software_tpm2: bool

Attach a per-VM software TPM 2.0 device.

§disk: DiskConfig

Primary system disk.

§install_media: Option<PathBuf>

Optional read-only installation image.

§network: NetworkConfig

Guest network configuration.

§audio: AudioMode

Guest audio backend.

§pointer_device: PointerDevice

QEMU USB pointer device; the tablet remains the compatibility default.

§usb_devices: Vec<UsbHostDevice>

Host USB devices cold-plugged into the guest.

§shares: Vec<DirectoryShare>

Host directories exposed through virtio-9p.

Implementations§

Source§

impl VmConfig

Source

pub fn new(name: String, disk: PathBuf, install_media: Option<PathBuf>) -> Self

Construct a VM definition with secure, broadly compatible defaults.

Source

pub fn load(path: &Path) -> Result<Self>

Load and validate a definition, resolving relative paths beside it.

Source

pub fn to_toml(&self) -> Result<String>

Serialize a definition to TOML.

Source

pub fn validate(&self) -> Result<()>

Validate values that must be safe before they reach QEMU or the filesystem.

Trait Implementations§

Source§

impl Clone for VmConfig

Source§

fn clone(&self) -> Self

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
Source§

impl Debug for VmConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VmConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for VmConfig

Source§

impl PartialEq for VmConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for VmConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for VmConfig

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.