Change network model type to support GigaByte transfers

This commit is contained in:
Pierre HUBERT 2023-12-27 10:27:19 +01:00
parent d8a6b58c52
commit b4f765d486
2 changed files with 18 additions and 2 deletions

View File

@ -77,13 +77,23 @@ pub struct NetIntSourceXML {
pub network: String, pub network: String,
} }
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename = "model")]
pub struct NetIntModelXML {
#[serde(rename(serialize = "@type"))]
pub r#type: String,
}
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename = "interface")] #[serde(rename = "interface")]
pub struct DomainNetInterfaceXML { pub struct DomainNetInterfaceXML {
#[serde(rename(serialize = "@type"))] #[serde(rename(serialize = "@type"))]
pub r#type: String, pub r#type: String,
pub mac: NetMacAddress, pub mac: NetMacAddress,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<NetIntSourceXML>, pub source: Option<NetIntSourceXML>,
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<NetIntModelXML>,
} }
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Serialize, serde::Deserialize)]

View File

@ -3,8 +3,8 @@ use crate::constants;
use crate::libvirt_lib_structures::{ use crate::libvirt_lib_structures::{
DevicesXML, DiskBootXML, DiskDriverXML, DiskReadOnlyXML, DiskSourceXML, DiskTargetXML, DiskXML, DevicesXML, DiskBootXML, DiskDriverXML, DiskReadOnlyXML, DiskSourceXML, DiskTargetXML, DiskXML,
DomainCPUTopology, DomainCPUXML, DomainInputXML, DomainMemoryXML, DomainNetInterfaceXML, DomainCPUTopology, DomainCPUXML, DomainInputXML, DomainMemoryXML, DomainNetInterfaceXML,
DomainVCPUXML, DomainXML, FeaturesXML, GraphicsXML, NetIntSourceXML, NetMacAddress, DomainVCPUXML, DomainXML, FeaturesXML, GraphicsXML, NetIntModelXML, NetIntSourceXML,
NetworkBridgeXML, NetworkDHCPHostXML, NetworkDHCPRangeXML, NetworkDHCPXML, NetMacAddress, NetworkBridgeXML, NetworkDHCPHostXML, NetworkDHCPRangeXML, NetworkDHCPXML,
NetworkDNSForwarderXML, NetworkDNSXML, NetworkDomainXML, NetworkForwardXML, NetworkIPXML, NetworkDNSForwarderXML, NetworkDNSXML, NetworkDomainXML, NetworkForwardXML, NetworkIPXML,
NetworkXML, OSLoaderXML, OSTypeXML, TPMBackendXML, TPMDeviceXML, VideoModelXML, VideoXML, NetworkXML, OSLoaderXML, OSTypeXML, TPMBackendXML, TPMDeviceXML, VideoModelXML, VideoXML,
XMLUuid, ACPIXML, OSXML, XMLUuid, ACPIXML, OSXML,
@ -250,6 +250,9 @@ impl VMInfo {
}, },
r#type: "user".to_string(), r#type: "user".to_string(),
source: None, source: None,
model: Some(NetIntModelXML {
r#type: "virtio".to_string(),
}),
}, },
NetworkType::DefinedNetwork { network } => DomainNetInterfaceXML { NetworkType::DefinedNetwork { network } => DomainNetInterfaceXML {
mac: NetMacAddress { mac: NetMacAddress {
@ -259,6 +262,9 @@ impl VMInfo {
source: Some(NetIntSourceXML { source: Some(NetIntSourceXML {
network: network.to_string(), network: network.to_string(),
}), }),
model: Some(NetIntModelXML {
r#type: "virtio".to_string(),
}),
}, },
}) })
} }