]> git.proxmox.com Git - pve-installer.git/commitdiff
tui: deserialize boot type and disk blocksize from runtime env info
authorChristoph Heiss <c.heiss@proxmox.com>
Mon, 24 Jul 2023 10:14:46 +0000 (12:14 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 25 Jul 2023 09:19:31 +0000 (11:19 +0200)
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@proxmox.com>
proxmox-tui-installer/src/options.rs
proxmox-tui-installer/src/setup.rs

index c8e8215c1cae8ef655de2df01e635cc23ad6afe0..dab1730781b0a09739de98ee43f6e354dfa1d8ec 100644 (file)
@@ -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 {
index 5e07f362de5c79135f6a314c46d276c250e177ed..e51bb4da79d517e97f7a849bb0daf6c36fccf107 100644 (file)
@@ -277,13 +277,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),
             },
@@ -366,6 +367,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>,
 
@@ -384,6 +388,13 @@ pub struct RuntimeInfo {
     pub hvm_supported: bool,
 }
 
+#[derive(Clone, Eq, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum BootType {
+    Bios,
+    Efi,
+}
+
 #[derive(Clone, Deserialize)]
 pub struct NetworkInfo {
     pub dns: Dns,