all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Noel Ullreich <n.ullreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve_installer v3] tui: don't abort install if min ram requirement is not met
Date: Mon, 10 Jul 2023 11:22:27 +0200	[thread overview]
Message-ID: <20230710092227.24642-1-n.ullreich@proxmox.com> (raw)

If the minimum requirements are not met, the TUI installer will create a
popup notifying you that the install might not work and then exits the
installer.
While the GUI also creates such a popup, it will not exit the installer.
This patch adapts the behavior of the GUI: the TUI creates a popup
warning you that min spec is not met but doesn't abort the install.

Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
---
changes from v1:
* moved the min ram check into `installer_setup_late`
* fixed spelling in the subject line

changes from v2:
* fixed formatting
* removed unnecessary `installer_setup_late` call

 proxmox-tui-installer/src/main.rs   | 13 +++++++++++--
 proxmox-tui-installer/src/system.rs | 14 +-------------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 64f21fa..8721358 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -243,8 +243,6 @@ fn installer_setup(in_test_mode: bool) -> Result<(LocaleInfo, RuntimeInfo), Stri
             .map_err(|err| format!("Failed to retrieve runtime environment info: {err}"))?
     };
 
-    system::has_min_requirements(&runtime_info)?;
-
     runtime_info.disks.sort();
     if runtime_info.disks.is_empty() {
         Err("The installer could not find any supported hard disks.".to_owned())
@@ -256,6 +254,7 @@ fn installer_setup(in_test_mode: bool) -> Result<(LocaleInfo, RuntimeInfo), Stri
 /// Anything that can be done late in the setup and will not result in fatal errors.
 fn installer_setup_late(siv: &mut Cursive) {
     let state = siv.user_data::<InstallerState>().unwrap();
+    let total_memory = state.runtime_info.total_memory;
 
     if !state.in_test_mode {
         let kmap_id = &state.options.timezone.kb_layout;
@@ -266,6 +265,16 @@ fn installer_setup_late(siv: &mut Cursive) {
         }
     }
 
+    if total_memory < 1024 {
+        display_setup_warning(
+            siv,
+            concat!(
+                "Less than 1 GiB of usable memory detected, installation will probably fail.\n\n",
+                "See 'System Requirements' in the documentation."
+            ),
+        );
+    }
+
     if setup_info().config.product == setup::ProxmoxProduct::PVE {
         let cpu_hvm = procfs::read_cpuinfo().map(|info| info.hvm).unwrap_or(false);
         if !cpu_hvm {
diff --git a/proxmox-tui-installer/src/system.rs b/proxmox-tui-installer/src/system.rs
index baceab9..bbf13b8 100644
--- a/proxmox-tui-installer/src/system.rs
+++ b/proxmox-tui-installer/src/system.rs
@@ -1,18 +1,6 @@
 use std::{fs::OpenOptions, io::Write, process::Command};
 
-use crate::setup::{KeyboardMapping, RuntimeInfo};
-
-pub fn has_min_requirements(info: &RuntimeInfo) -> Result<(), String> {
-    if info.total_memory < 1024 {
-        return Err(concat!(
-            "Less than 1 GiB of usable memory detected, installation will probably fail.\n\n",
-            "See 'System Requirements' in the documentation."
-        )
-        .to_owned());
-    }
-
-    Ok(())
-}
+use crate::setup::KeyboardMapping;
 
 pub fn set_keyboard_layout(kmap: &KeyboardMapping) -> Result<(), String> {
     Command::new("setxkbmap")
-- 
2.39.2





             reply	other threads:[~2023-07-10  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  9:22 Noel Ullreich [this message]
2023-07-10  9:48 ` Christoph Heiss
2023-07-13 14:06 ` [pve-devel] applied: " 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=20230710092227.24642-1-n.ullreich@proxmox.com \
    --to=n.ullreich@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