pub struct VirtioDeviceConfig {
pub device_type: VirtioDeviceType,
pub config: Vec<u8>,
pub path: Option<String>,
pub read_only: bool,
pub tag: Option<String>,
pub net_fd: Option<i32>,
pub mac_address: Option<String>,
}Expand description
VirtIO device configuration for attaching to a VM.
Fields§
§device_type: VirtioDeviceTypeDevice type.
config: Vec<u8>Device-specific configuration.
path: Option<String>Path to device (for block/fs devices).
read_only: boolWhether the device is read-only.
tag: Option<String>Tag for filesystem devices.
net_fd: Option<i32>File descriptor for file-handle-based network attachment.
mac_address: Option<String>Optional MAC address for network devices.
Implementations§
Source§impl VirtioDeviceConfig
impl VirtioDeviceConfig
Sourcepub fn block(path: impl Into<String>, read_only: bool) -> Self
pub fn block(path: impl Into<String>, read_only: bool) -> Self
Creates a new block device configuration.
Sourcepub fn network_with_mac(mac_address: impl Into<String>) -> Self
pub fn network_with_mac(mac_address: impl Into<String>) -> Self
Creates a new network device configuration with NAT attachment and an explicit MAC address.
Sourcepub const fn network_file_handle(fd: i32) -> Self
pub const fn network_file_handle(fd: i32) -> Self
Creates a network device configuration with file-handle attachment.
The VZ framework side uses one connected datagram socket file descriptor for bidirectional frame I/O.
Sourcepub fn network_file_handle_with_mac(
fd: i32,
mac_address: impl Into<String>,
) -> Self
pub fn network_file_handle_with_mac( fd: i32, mac_address: impl Into<String>, ) -> Self
Creates a network device configuration with file-handle attachment and an explicit MAC address.
Use this when the MAC must match an external interface (e.g. vmnet) so that bridge FDB lookups resolve correctly.
Trait Implementations§
Source§impl Clone for VirtioDeviceConfig
impl Clone for VirtioDeviceConfig
Source§fn clone(&self) -> VirtioDeviceConfig
fn clone(&self) -> VirtioDeviceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more