Fix secure boot issue

This commit is contained in:
Pierre HUBERT 2023-10-20 11:15:16 +02:00
parent a30f9720ca
commit 081b0f7784
2 changed files with 34 additions and 18 deletions

View File

@ -32,6 +32,8 @@ pub struct OSXML {
pub struct OSTypeXML {
#[serde(rename(serialize = "@arch"))]
pub arch: String,
#[serde(rename(serialize = "@machine"))]
pub machine: String,
#[serde(rename = "$value")]
pub body: String,
}
@ -93,7 +95,8 @@ pub struct DiskXML {
pub target: DiskTargetXML,
pub readonly: DiskReadOnlyXML,
pub boot: DiskBootXML,
pub address: DiskAddressXML,
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<DiskAddressXML>,
}
#[derive(serde::Serialize, serde::Deserialize)]
@ -137,14 +140,26 @@ pub struct DiskBootXML {
pub struct DiskAddressXML {
#[serde(rename(serialize = "@type"))]
pub r#type: String,
#[serde(rename(serialize = "@controller"))]
pub r#controller: String,
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename(serialize = "@controller")
)]
pub r#controller: Option<String>,
#[serde(rename(serialize = "@bus"))]
pub r#bus: String,
#[serde(rename(serialize = "@target"))]
pub r#target: String,
#[serde(rename(serialize = "@unit"))]
pub r#unit: String,
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename(serialize = "@target")
)]
pub r#target: Option<String>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
rename(serialize = "@unit")
)]
pub r#unit: Option<String>,
}
/// Domain RAM information

View File

@ -1,9 +1,9 @@
use crate::app_config::AppConfig;
use crate::constants;
use crate::libvirt_lib_structures::{
DevicesXML, DiskAddressXML, DiskBootXML, DiskDriverXML, DiskReadOnlyXML, DiskSourceXML,
DiskTargetXML, DiskXML, DomainMemoryXML, DomainXML, DomainXMLUuid, FeaturesXML, GraphicsXML,
OSLoaderXML, OSTypeXML, ACPIXML, OSXML,
DevicesXML, DiskBootXML, DiskDriverXML, DiskReadOnlyXML, DiskSourceXML, DiskTargetXML, DiskXML,
DomainMemoryXML, DomainXML, DomainXMLUuid, FeaturesXML, GraphicsXML, OSLoaderXML, OSTypeXML,
ACPIXML, OSXML,
};
use crate::libvirt_rest_structures::LibVirtStructError::StructureExtraction;
use crate::utils::files_utils;
@ -133,19 +133,19 @@ impl VMInfo {
},
target: DiskTargetXML {
dev: "hdc".to_string(),
bus: "ide".to_string(),
bus: "usb".to_string(),
},
readonly: DiskReadOnlyXML {},
boot: DiskBootXML {
order: "1".to_string(),
},
address: DiskAddressXML {
r#type: "drive".to_string(),
controller: "0".to_string(),
bus: "1".to_string(),
target: "0".to_string(),
unit: "0".to_string(),
},
address: None, /*DiskAddressXML {
r#type: "drive".to_string(),
controller: "0".to_string(),
bus: "1".to_string(),
target: "0".to_string(),
unit: "0".to_string(),
},*/
})
}
@ -176,6 +176,7 @@ impl VMInfo {
VMArchitecture::X86_64 => "x86_64",
}
.to_string(),
machine: "q35".to_string(),
body: "hvm".to_string(),
},
firmware: "efi".to_string(),