This commit is contained in:
parent
5518b45219
commit
4ee01cad4b
@ -22,10 +22,13 @@ pub struct DomainMetadataXML {
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename = "os")]
|
||||
pub struct OSXML {
|
||||
#[serde(rename = "@firmware", default)]
|
||||
pub firmware: String,
|
||||
#[serde(rename = "@firmware", default, skip_serializing_if = "Option::is_none")]
|
||||
pub firmware: Option<String>,
|
||||
pub r#type: OSTypeXML,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub loader: Option<OSLoaderXML>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bootmenu: Option<OSBootMenuXML>,
|
||||
pub smbios: Option<OSSMBiosXML>,
|
||||
}
|
||||
|
||||
@ -49,6 +52,16 @@ pub struct OSLoaderXML {
|
||||
pub secure: String,
|
||||
}
|
||||
|
||||
/// Legacy boot menu information
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename = "bootmenu")]
|
||||
pub struct OSBootMenuXML {
|
||||
#[serde(rename = "@enable")]
|
||||
pub enable: String,
|
||||
#[serde(rename = "@timeout")]
|
||||
pub timeout: usize,
|
||||
}
|
||||
|
||||
/// SMBIOS System information
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename = "smbios")]
|
||||
|
@ -17,6 +17,7 @@ pub struct VMGroupId(pub String);
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
pub enum BootType {
|
||||
Legacy,
|
||||
UEFI,
|
||||
UEFISecureBoot,
|
||||
}
|
||||
@ -351,13 +352,26 @@ impl VMInfo {
|
||||
machine: "q35".to_string(),
|
||||
body: "hvm".to_string(),
|
||||
},
|
||||
firmware: "efi".to_string(),
|
||||
loader: Some(OSLoaderXML {
|
||||
secure: match self.boot_type {
|
||||
BootType::UEFI => "no".to_string(),
|
||||
BootType::UEFISecureBoot => "yes".to_string(),
|
||||
},
|
||||
}),
|
||||
firmware: match self.boot_type {
|
||||
BootType::Legacy => None,
|
||||
_ => Some("efi".to_string()),
|
||||
},
|
||||
loader: match self.boot_type {
|
||||
BootType::Legacy => None,
|
||||
_ => Some(OSLoaderXML {
|
||||
secure: match self.boot_type {
|
||||
BootType::UEFISecureBoot => "yes".to_string(),
|
||||
_ => "no".to_string(),
|
||||
},
|
||||
}),
|
||||
},
|
||||
bootmenu: match self.boot_type {
|
||||
BootType::Legacy => Some(OSBootMenuXML {
|
||||
enable: "yes".to_string(),
|
||||
timeout: 3000,
|
||||
}),
|
||||
_ => None,
|
||||
},
|
||||
smbios: Some(OSSMBiosXML {
|
||||
mode: "sysinfo".to_string(),
|
||||
}),
|
||||
@ -449,9 +463,10 @@ impl VMInfo {
|
||||
.virtweb
|
||||
.group
|
||||
.map(VMGroupId),
|
||||
boot_type: match domain.os.loader {
|
||||
None => BootType::UEFI,
|
||||
Some(l) => match l.secure.as_str() {
|
||||
boot_type: match (domain.os.loader, domain.os.bootmenu) {
|
||||
(_, Some(_)) => BootType::Legacy,
|
||||
(None, _) => BootType::UEFI,
|
||||
(Some(l), _) => match l.secure.as_str() {
|
||||
"yes" => BootType::UEFISecureBoot,
|
||||
_ => BootType::UEFI,
|
||||
},
|
||||
|
@ -82,6 +82,8 @@ export interface VMNetBridge {
|
||||
bridge: string;
|
||||
}
|
||||
|
||||
export type VMBootType = "UEFI" | "UEFISecureBoot" | "Legacy";
|
||||
|
||||
interface VMInfoInterface {
|
||||
name: string;
|
||||
uuid?: string;
|
||||
@ -89,7 +91,7 @@ interface VMInfoInterface {
|
||||
title?: string;
|
||||
description?: string;
|
||||
group?: string;
|
||||
boot_type: "UEFI" | "UEFISecureBoot";
|
||||
boot_type: VMBootType;
|
||||
architecture: "i686" | "x86_64";
|
||||
memory: number;
|
||||
number_vcpu: number;
|
||||
@ -108,7 +110,7 @@ export class VMInfo implements VMInfoInterface {
|
||||
title?: string;
|
||||
description?: string;
|
||||
group?: string;
|
||||
boot_type: "UEFI" | "UEFISecureBoot";
|
||||
boot_type: VMBootType;
|
||||
architecture: "i686" | "x86_64";
|
||||
number_vcpu: number;
|
||||
memory: number;
|
||||
|
@ -280,6 +280,7 @@ function VMDetailsTabGeneral(p: DetailsInnerProps): React.ReactElement {
|
||||
options={[
|
||||
{ label: "UEFI with Secure Boot", value: "UEFISecureBoot" },
|
||||
{ label: "UEFI", value: "UEFI" },
|
||||
{ label: "Legacy", value: "Legacy" },
|
||||
]}
|
||||
/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user