Commit Graph

979 Commits

Author SHA1 Message Date
Christoph Heiss
dba905bfa5 tui: move install progress dialog into own view module
While at it, convert it to a proper `View`-impl, instead of a functional
component.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-11 14:08:41 +01:00
Christoph Heiss
eda9fa0c6c fix #4856: tui: bootdisk: use correct defaults in advanced dialog
The size of the install disk was set to the size of the first disk,
regardless of what disk was selected. This only happened if the advanced
options dialog was never opened, and only a disk was selected in the
main bootdisk dialog.

Properly solving this involved restructuring the LVM advanced bootdisk
dialog, to also hold the selected disks, like the ZFS and Btrfs dialogs.
In addition to that, the `BootdiskOptionsRef` needs quite some passing
around, to cover all the cases, since the dialog also needs to be
"reentrant-safe".

I tested (among other things):
  * Only select disk, don't open the advanced dialog, go to summary,
    then back to the bootdisk dialog -> selected disk should be kept
  * Select disk, open advanced dialog but leave everything as is, go to
    summary, then go back again -> selected disk should be kept
  * Same as previous, but change the "Total size" for the disk, go to
    summary and back -> selected disk and size should be kept
  * Same as previous, but additionally change filesystem to XFS -> disk,
    filesystem and size should be kept
  * Same as previous, but then create a ZFS RAID, go to summary & back,
    ZFS RAID should be kept with all parameters
  * etc ..

Further I also verified that the correct disk size(s) get written into
the setup structure for the low-level installer.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-09 14:47:03 +01:00
Christoph Heiss
d81cffcbb4 tui: bootdisk: refactor Rc<RefCell<..>> type into custom type
Will be used/passed around quite a lot of times due to future changes,
so simplify it a bit.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-09 14:47:03 +01:00
Christoph Heiss
4b4dfa12e0 low level: testmode: take path to disk image instead of using /dev/null
.. in exactly the same way GUI and TUI installer do, streamlining them.

Up until now, testing the TUI installer often involved hand-editing the
`run-env-info.json` to put some proper disk sizes > 0 in place. This
makes this process a lot easier.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-09 14:44:51 +01:00
Christoph Heiss
521dfff583 tui: bootdisk: expose arc_max ZFS option for PVE installations
To set the maximum value for arc_max accordingly, simply pass down
`RuntimeInfo` directly instead of the disks array to the views.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
13490d13b6 common: add ZFS arc_max installer setup option
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
9a0d66cb36 test: add tests for zfs_arc_max calculations
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
4c25372e50 proxinstall: expose arc_max ZFS option for PVE installations
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
e8103d4288 install: use correct variable names in zfs_setup_module_conf()
That's what happens when you do some last-minute variable renaming and
trust that nothing broke ..

Fixes: 42aa2fa ("fix #4829: install: add new ZFS `arc_max` setup option")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
c8f6256dab run env: remove debug print
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:40:15 +01:00
Christoph Heiss
0f39ba9300 tui: fix same "Administrator" typo in password and summary view
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-07 16:39:35 +01:00
Stoiko Ivanov
f5ccbd946b install: install correct grub metapackage for the current boot-mode
grub packages in debian split between:

* meta-packages, which handles (among other things) the reinstalling
  grub to the actual device/ESP in case of a version upgrade (grub-pc,
  grub-efi-amd64)

* bin-packages, which contain the actual boot-loaders

The bin-packages can coexist on a system, but the meta-package
conflict with each other (didn't check why, but I don't see a hard
conflict on a quick glance)

Currently our ISO installs grub-pc unconditionally (and both bin
packages, since we install the legacy bootloader also on uefi-booted
systems). This results in uefi-systems not getting a new grub
installed automatically upon upgrade.

Reported in our community-forum from users who upgraded to PVE 8.0,
and still run into an issue fixed in grub for bookworm:
https://forum.proxmox.com/threads/.123512/

Reproduced and analyzed by Friedrich.

This patch changes the installer, to install the meta-package fitting
for the boot-mode.

We do not set the debconf variable install_devices, because the
'install_devices' variable is only defined for 'grub-pc', and thus
(still) only set for that package/namespace.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-11-06 18:29:58 +01:00
Filip Schauer
d54381c74c Correct DNS IP check on management interface setup
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2023-11-06 17:40:16 +01:00
Christoph Heiss
42aa2fa7ef fix #4829: install: add new ZFS arc_max setup option
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-06 15:49:31 +01:00
Christoph Heiss
e8a7b9ba86 tui: bootdisk: simplify product handling by passing the config directly
No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-06 15:48:18 +01:00
Christoph Heiss
801f5a283b tui: views: add optional suffix label for NumericEditViews
Most of the churn here is due to changing the inner view from an
`EditView` to a `LinearLayout`. Also prompted the introduction of two
small helpers .inner() and .inner_mut() to simplify things everywhere
else in the view.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-06 15:47:29 +01:00
Christoph Heiss
ed2b90a412 run env: add comment for query_total_memory()
This is mainly to explicitly document the unit of its return value.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-03 13:00:40 +01:00
Christoph Heiss
5716113910 tui: fix clippy warning
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-03 12:52:56 +01:00
Christoph Heiss
feea90d471 tui, common: run rustfmt
While at it, move rustfmt.toml to the repo root, to share it with the
other crate.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-03 12:52:56 +01:00
Aaron Lauterer
c16d6893ec tui: remove unused read_json function
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:40 +01:00
Aaron Lauterer
9a8485808f tui: use installer_setup from common cate
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:38 +01:00
Aaron Lauterer
40b35db0f6 common: document installer_setup method
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:35 +01:00
Aaron Lauterer
1ac989e326 common: add installer_setup method
moved over from the TUI installer

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:33 +01:00
Aaron Lauterer
b2dfe0ba07 tui: remove now unused utils.rs
all it did moved to the common crate

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:30 +01:00
Aaron Lauterer
86c48f76f0 tui: switch to common crate
by switching dependencies and deleting doubled code to avoid ambiguities
within the same scope.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:26 +01:00
Aaron Lauterer
41f2a23371 tui-installer: add dependency for new common crate
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:24 +01:00
Aaron Lauterer
a83d1c96b2 common: disk_checks: make functions public
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:21 +01:00
Aaron Lauterer
2dbee15510 common: make InstallZfsOption public
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:18 +01:00
Aaron Lauterer
eeb062724f common: utils: add dependency for doc test
Was probably missed because it used to be in a binary crate where doc
tests aren't run automatically.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:14 +01:00
Aaron Lauterer
5362c05cd1 common: copy common code from tui-installer
Copy code that is common to its own crate.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:06 +01:00
Aaron Lauterer
2f65a616d3 add proxmox-installer-common crate
It will be used for code shared among the different crates in the
installer. For now between the TUI installer and the upcoming auto
installer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [TL: fold in Christoph's buildsys fix ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-02 20:04:02 +01:00
Christoph Heiss
2789d95b71 tui: remove obsolete, global SetupInfo state
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
e14adfe3a3 tui: bootdisk: pass down product info to advanced dialog
Enables the advanced and LVM dialog to determine what options (max
root/data size and Btrfs RAIDs) by itself, without needing to resort to
the global `setup_info()` function.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
2f0b4f7c9b tui: refactor NetworkOptions to have a defaults_from() function
This aligns it with the other constructors for options struct by
introducing a `::defaults_from()` function.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-25 19:03:13 +02:00
Christoph Heiss
9f73c54b87 tui: add some tests for NetworkInfo -> NetworkOptions conversion
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: merge fix for missing state member when declaring a Interface
   struct in a test on master ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-20 17:12:53 +02:00
Christoph Heiss
ce01876bbc tui: use hostname from run env if available
This now tries to use the hostname from the DHCP lease if it was set,
falling back to the product name as before.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
8268b2e5b0 proxinstall: use hostname from run env if available
This now tries to use the hostname from the DHCP lease if it was set,
falling back to the product name as before.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
bda1cdf699 run env: retrieve and store hostname from DHCP lease if available
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Christoph Heiss
18f58123e8 net: move hostname/fqdn regexes into common code
Such that they can be re-used by other parts.
No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-10-20 12:31:22 +02:00
Thomas Lamprecht
9ed182696c buildsys: redirect stderr of TUI in check targets
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:19:51 +02:00
Thomas Lamprecht
89dfa5c9f1 tui: fix interface sorting
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:19:06 +02:00
Thomas Lamprecht
55e5c9cdc9 tui: show interface UP state as filled circle
like we do in the GTK UI since recently, there we also color the
filled circle green, but with current cursive crate version this
doesn't seem to be easy, at least not without breaking its theming a
bit (e.g., by just using ANSI escape codes), so just use the circle
for now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 14:18:40 +02:00
Thomas Lamprecht
5c4501655a add interface state to run-time environment
making this slowly compatible with our battle-proven ifaces entry..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-19 13:34:37 +02:00
Maximiliano Sandoval
124ca33f9f fix #4869: Show state in management interface ComboBox
This is a continuation of
https://lists.proxmox.com/pipermail/pve-devel/2023-August/058639.html.

Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>
Tested-by: Filip Schauer <f.schauer@proxmox.com>
2023-10-19 11:19:59 +02:00
Christoph Heiss
eccdfb850a sys: block: fix inverted check when detecting block size
We do actually want the block size if it is integer - currently, it is
always set to `undef` (and then `null` in the serialized JSON).

Fixes: 15b2cd7 ("sys: block: fix possible use of `undef`-value when detecting disk sizes")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-09-21 15:42:40 +02:00
Christoph Heiss
a56e078abb tui: honor test mode flag when starting low-level install session
Even if the installer is run in release mode, the test-mode flag should
be honored on whether to start a test-installation or not.

The test mode is always forced on in debug builds, so the cfg()
conditionals can be dropped.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-09-20 15:38:46 +02:00
Christoph Heiss
c733cb3b26 tui: fix search domain parsing from runtime environment info
Commit 55dc67c ("tui: fix FQDN validation") mostly fixed FQDN
validation, but missed a case when the search domain only has one
component.

As Fqdn::from() requires at least two components to pass validation, the
search domain parsing from the runtime environment info provided by the
low-level installer failed. This resulted in that the network dialog
defaulted to "<product>.example.invalid" as FQDN, instead of
"<product>.<searchdomain>" as it should.

Fixes: 55dc67c ("tui: fix FQDN validation")
Reported-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:38:14 +02:00
Christoph Heiss
fea97303fd tui: disallow legacy BIOS boot from 4Kn disks for all filesystems
The GUI installer already has the same rules in place, not allowing to
boot from 4Kn disks when booting in legacy BIOS mode. The TUI installer
currently only checks that for ZFS RAIDs, so extend that check to all
filesystem configurations.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:31:57 +02:00
Christoph Heiss
8b8efb9d08 raid setup: btrfs: do not allow legacy BIOS boot on 4Kn disks
This is already checked for LVM and ZFS setups, but not for Btrfs. Add
it there too, as it doesn't work anyway.

Tested by creating a block device with 4K sectorsize using
the following QEMU args:
  -device virtio-blk,drive=testdrive4k,logical_block_size=4096,physical_block_size=4096
  -drive file=/path/to/4k-testdisk.img,if=none,id=testdrive4k

The 4k-testdisk.img was created with:
  qemu-img create -f qcow2 /path/to/4k-testdisk.img 16G

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:31:55 +02:00
Christoph Heiss
749572552d tui: setup: handle missing disk block size gracefully
As that value can indeed be undefined, handle that (edge-)case
gracefully. There is only one place where it is checked, in the ZFS RAID
setup dialog. Aligns it with how the low-level installer handles that
case too.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:56 +02:00