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,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename = "model")]
pub struct NetIntModelXML {
#[serde(rename(serialize = "@type"))]
pub r#type: String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename = "interface")]
pub struct DomainNetInterfaceXML {
#[serde(rename(serialize = "@type"))]
pub r#type: String,
pub mac: NetMacAddress,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<NetIntSourceXML>,
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<NetIntModelXML>,
}
#[derive(serde::Serialize, serde::Deserialize)]

View File

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