From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer v2 2/6] tui: deserialize boot type and disk blocksize from runtime env info
Date: Mon, 24 Jul 2023 12:14:46 +0200 [thread overview]
Message-ID: <20230724101517.462214-3-c.heiss@proxmox.com> (raw)
In-Reply-To: <20230724101517.462214-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>
---
Changes v1 -> v2:
* No changes
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 5e07f36..e51bb4d 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -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,
--
2.41.0
next prev parent reply other threads:[~2023-07-24 10:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 10:14 [pve-devel] [PATCH installer v2 0/6] tui: add ZFS/Btrfs RAID setup checks Christoph Heiss
2023-07-24 10:14 ` [pve-devel] [PATCH installer v2 1/6] tui: simplify duplicate disk checking logic Christoph Heiss
2023-07-24 10:14 ` Christoph Heiss [this message]
2023-07-24 10:14 ` [pve-devel] [PATCH installer v2 3/6] tui: improve bootdisk dialog error handling Christoph Heiss
2023-07-24 10:14 ` [pve-devel] [PATCH installer v2 4/6] tui: add RAID setup checks for ZFS/Btrfs Christoph Heiss
2023-07-24 10:14 ` [pve-devel] [PATCH installer v2 5/6] tui: add tests for RAID setup checks Christoph Heiss
2023-07-24 10:14 ` [pve-devel] [PATCH installer v2 6/6] d/rules: enable dh_auto_test Christoph Heiss
2023-07-25 9:38 ` [pve-devel] applied-series: [PATCH installer v2 0/6] tui: add ZFS/Btrfs RAID setup checks 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=20230724101517.462214-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox