Commit Graph

17 Commits

Author SHA1 Message Date
Aaron Lauterer
74e54c4d8d low-level: add dump-udev command
Fetches UDEV device properties prepended with 'E:' for NICs and disks.
The result is stored in its own JSON file.

This information is needed to filter for specific devices. Mainly for
the auto-installer for now.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 [ TL: rework Udev module to avoid external dependencies, keep those
   in the Sys modules ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 14:31:37 +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
15b2cd7632 sys: block: fix possible use of undef-value when detecting disk sizes
`$size` and `$logical_bsize` might get unset if there invalid, but then
are unconditionally converted to an int - which throws an error.
This was reported on the forum by a user [0].

Fix it by changing the check a bit to skip the disk immediately if
detecting either of those two values are invalid or simply not present.
The fix for `$logical_bsize` simply avoids trying to convert to value to
an int if invalid.

tl;dr: Should have no impact at all, in the end. The same
`run-env-info.json` is generated w/ and w/o the patch if all disks are
fine. I then also hacked up the script a bit to actually have an invalid
size, this resulted in the "affected" disk simply missing from the disk
array - the expected behavior in this case.

[0] https://forum.proxmox.com/threads/error-installing-proxmox-8.131921/

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-23 10:19:54 +02:00
Philipp Hufnagl
7b8ac1b805 disk partitioning: fix checking answer for to-small-disk prompt
Currently there is a bug that you only can install < 8 GB when you NOT
accept the warning. This is wrong. A user should have to accept the
warning to install on small systems

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
 [T: reword commit subject & fix typo there ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-07-13 16:15:44 +02:00
Thomas Lamprecht
25de20e33a sys block: fix id for test disks
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 16:20:41 +02:00
Thomas Lamprecht
59096f791f Revert "critic: lazily read directories via <> glob"
Perl definitively acts very different with the while variant, it
seems it keeps the file handle open and reuses it in future calls,
even if the directory base of the glob is different

This reverts commit 90fb3d7615.
2023-06-22 10:45:59 +02:00
Thomas Lamprecht
90fb3d7615 critic: lazily read directories via <> glob
the for/foreach ones read everything in to build a list and then
iterate that, the while one is lazy and needs less memory.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 07:37:25 +02:00
Thomas Lamprecht
7d53c80701 critic: avoid $a, $b special package variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 07:35:56 +02:00
Thomas Lamprecht
ed68d1244d fix checking the now boolean prompt response
When the prompt abstraction got added in bc05a8f ("add basic UI
plugin infrastructure") it also inlined the check for the answer, as
that can be differently structured for each user interface, and
returns bool. But when switching over to this new infra, two sites
weren't updated to the simpler bool check and still checked with the
previous "equals 'ok'", which now was always false.

Fixes: 72bea99 ("switch prompt, error and message calls to new UI infra")
Reported-by: Alexander Zeidler <a.zeidler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-22 07:21:19 +02:00
Thomas Lamprecht
ceec3def24 run env: use single source of truth for block devices
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-20 14:24:46 +02:00
Thomas Lamprecht
72bea99528 switch prompt, error and message calls to new UI infra
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-19 21:49:00 +02:00
Thomas Lamprecht
026620be2f rename Env to ISOEnv
in preparation of adding a runtime env module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-14 13:26:38 +02:00
Thomas Lamprecht
c2d5b241f1 visibility fixes for calling into sys/block helpers
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
cc9987a96e code/style cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
40fbf8e63b move global cached disk state into block module
.. and introduce some helpers to finding/getting cached disks.

The hd_list method, which scans for physical disks, can be made
private with this change.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
408a519a59 sys block: cleanup disk list a bit
The assignment to () is confusing, as that's effectively identical
with not assigning it at all and later auto-vivify it to an array
ref, make that more explicit instead.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
5cfca6d702 factor out disk & block device helpers helpers into own module
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00