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

View File

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