From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 3/3] tui: check hvm support through runtime env info instead of open-coding
Date: Mon, 3 Jul 2023 09:35:00 +0200 [thread overview]
Message-ID: <20230703073500.290868-4-c.heiss@proxmox.com> (raw)
In-Reply-To: <20230703073500.290868-1-c.heiss@proxmox.com>
As the runtime environment now exports that info, use it. In turn, this
allows us to drop the dependency on `proxmox-sys`, as that check was its
only user.
The dependency graph drops from 107 to 88 crates from this, which
definitively is a nice change.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
proxmox-tui-installer/Cargo.toml | 2 --
proxmox-tui-installer/src/main.rs | 25 ++++++++++---------------
proxmox-tui-installer/src/setup.rs | 4 ++++
3 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/proxmox-tui-installer/Cargo.toml b/proxmox-tui-installer/Cargo.toml
index 5a50c69..8a6eba8 100644
--- a/proxmox-tui-installer/Cargo.toml
+++ b/proxmox-tui-installer/Cargo.toml
@@ -12,5 +12,3 @@ cursive = { version = "0.20.0", default-features = false, features = ["termion-b
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = "1.7"
-
-proxmox-sys = "0.5.0"
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 64f21fa..109def3 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -25,13 +25,11 @@ use cursive::{
use regex::Regex;
-use proxmox_sys::linux::procfs;
-
mod options;
use options::*;
mod setup;
-use setup::{InstallConfig, LocaleInfo, RuntimeInfo, SetupInfo};
+use setup::{InstallConfig, LocaleInfo, ProxmoxProduct, RuntimeInfo, SetupInfo};
mod system;
@@ -255,7 +253,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 state = siv.user_data::<InstallerState>().cloned().unwrap();
if !state.in_test_mode {
let kmap_id = &state.options.timezone.kb_layout;
@@ -266,17 +264,14 @@ fn installer_setup_late(siv: &mut Cursive) {
}
}
- if setup_info().config.product == setup::ProxmoxProduct::PVE {
- let cpu_hvm = procfs::read_cpuinfo().map(|info| info.hvm).unwrap_or(false);
- if !cpu_hvm {
- display_setup_warning(
- siv,
- concat!(
- "No support for hardware-accelerated KVM virtualization detected.\n\n",
- "Check BIOS settings for Intel VT / AMD-V / SVM."
- ),
- );
- }
+ if state.setup_info.config.product == ProxmoxProduct::PVE && !state.runtime_info.hvm_supported {
+ display_setup_warning(
+ siv,
+ concat!(
+ "No support for hardware-accelerated KVM virtualization detected.\n\n",
+ "Check BIOS settings for Intel VT / AMD-V / SVM."
+ ),
+ );
}
}
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index 68207c8..9d14cf8 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -367,6 +367,10 @@ pub struct RuntimeInfo {
/// Total memory of the system in MiB.
pub total_memory: usize,
+
+ /// Whether the CPU supports hardware-accelerated virtualization
+ #[serde(deserialize_with = "deserialize_bool_from_int")]
+ pub hvm_supported: bool,
}
#[derive(Clone, Deserialize)]
--
2.40.1
next prev parent reply other threads:[~2023-07-03 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 7:34 [pve-devel] [PATCH installer 0/3] export hvm support flag through runtime env Christoph Heiss
2023-07-03 7:34 ` [pve-devel] [PATCH installer 1/3] run env: add hardware-accelerated virtualization support flag Christoph Heiss
2023-07-03 7:34 ` [pve-devel] [PATCH installer 2/3] proxinstall: check hvm support through runtime env info Christoph Heiss
2023-07-03 7:35 ` Christoph Heiss [this message]
2023-07-04 8:27 ` [pve-devel] [PATCH installer 4/4] d/control: drop unused librust-proxmox-sys-dev build dependency Christoph Heiss
2023-07-13 13:50 ` [pve-devel] applied-series: [PATCH installer 0/3] export hvm support flag through runtime env 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=20230703073500.290868-4-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