[pve-devel] [PATCH installer 4/7] tui: deserialize boot type and disk blocksize from runtime env info
Christoph Heiss
c.heiss at proxmox.com
Thu Jul 13 11:49:28 CEST 2023
This is needed later on to check whether a RAID setup is compatible with
BIOS and 4Kn disks, in particular ZFS.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
proxmox-tui-installer/src/options.rs | 1 +
proxmox-tui-installer/src/setup.rs | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index c8e8215..dab1730 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -222,6 +222,7 @@ pub struct Disk {
pub path: String,
pub model: Option<String>,
pub size: f64,
+ pub block_size: usize,
}
impl fmt::Display for Disk {
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index e8ee7f3..c56e608 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -262,13 +262,14 @@ fn deserialize_disks_map<'de, D>(deserializer: D) -> Result<Vec<Disk>, D::Error>
where
D: Deserializer<'de>,
{
- let disks = <Vec<(usize, String, f64, String, f64, String)>>::deserialize(deserializer)?;
+ let disks = <Vec<(usize, String, f64, String, usize, String)>>::deserialize(deserializer)?;
Ok(disks
.into_iter()
.map(
|(index, device, size_mb, model, logical_bsize, _syspath)| Disk {
index: index.to_string(),
- size: (size_mb * logical_bsize) / 1024. / 1024. / 1024.,
+ size: (size_mb * logical_bsize as f64) / 1024. / 1024. / 1024.,
+ block_size: logical_bsize,
path: device,
model: (!model.is_empty()).then_some(model),
},
@@ -351,6 +352,9 @@ where
#[derive(Clone, Deserialize)]
pub struct RuntimeInfo {
+ /// Whether is system was booted in (legacy) BIOS or UEFI mode.
+ pub boot_type: BootType,
+
/// Detected country if available.
pub country: Option<String>,
@@ -365,6 +369,13 @@ pub struct RuntimeInfo {
pub total_memory: usize,
}
+#[derive(Clone, Eq, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum BootType {
+ Bios,
+ Efi,
+}
+
#[derive(Clone, Deserialize)]
pub struct NetworkInfo {
pub dns: Dns,
--
2.41.0
More information about the pve-devel
mailing list