all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 4/7] tui: deserialize boot type and disk blocksize from runtime env info
Date: Thu, 13 Jul 2023 11:49:28 +0200	[thread overview]
Message-ID: <20230713094941.475486-5-c.heiss@proxmox.com> (raw)
In-Reply-To: <20230713094941.475486-1-c.heiss@proxmox.com>

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 |  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





  parent reply	other threads:[~2023-07-13  9:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13  9:49 [pve-devel] [PATCH installer 0/7] tui: add ZFS/Btrfs RAID setup checks Christoph Heiss
2023-07-13  9:49 ` [pve-devel] [PATCH installer 1/7] gitignore: add cd-info.test Christoph Heiss
2023-07-13  9:49 ` [pve-devel] [PATCH installer 2/7] tui: fix small typo in error message Christoph Heiss
2023-07-13  9:49 ` [pve-devel] [PATCH installer 3/7] tui: simplify duplicate disk checking logic Christoph Heiss
2023-07-13  9:49 ` Christoph Heiss [this message]
2023-07-13  9:49 ` [pve-devel] [PATCH installer 5/7] tui: improve bootdisk dialog error handling Christoph Heiss
2023-07-13  9:49 ` [pve-devel] [PATCH installer 6/7] tui: add RAID setup checks for ZFS/Btrfs Christoph Heiss
2023-07-13  9:49 ` [pve-devel] [PATCH installer 7/7] tui: add tests for RAID setup checks Christoph Heiss
2023-07-21 14:20 ` [pve-devel] partially-applied: [PATCH installer 0/7] tui: add ZFS/Btrfs " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230713094941.475486-5-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal