public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: Christoph Heiss <c.heiss@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [RFC PATCH pve-installer 3/6] close #5887: add sanity check for LVM swapsize and maxroot
Date: Tue, 29 Apr 2025 13:30:46 +0200	[thread overview]
Message-ID: <7fbf581b-0988-47ab-b91a-1feb21b4c4cf@proxmox.com> (raw)
In-Reply-To: <D9I97JAG9HE9.2KGXZBX5WKXUU@proxmox.com>

On 4/28/25 14:00, Christoph Heiss wrote:
> On Tue Apr 22, 2025 at 6:27 PM CEST, Michael Köppl wrote:
>> Check that the configured swapsize is not greater than the total size
>> of the disk and that maxroot is at most hdsize / 4. Define the
>> behavior for the auto-installer as well as the TUI and GUI installers.
>>
>> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
>> ---
>> The changes implemented in this patch regarding swap size only avoid
>> rather obvious misconfigurations. However, users could still configure a
>> 32GB swap volume on a 32GB hard disk and the installer would fail later
>> on. Users could benefit another check that ensures the swap volume size
>> does not go beyond a certain threshold. One option could be to set the
>> limit similar to the 8GB maximum when the swap volume size is calculated
>> from the size of the memory. OTOH, this might also be
>> considered too restrictive. Would love some input on this.
> 
> I'd limit the swapsize to hdsize/8, as we state in the admin guide [0].
> Although I'm not sure if we actually check this somewhere currently.

As far as I can tell, the hdsize/8 limit in the admin guide at the 
moment only refers to the value being calculated from the memory size. I 
added a check to limit the maximum swap size entered by users to 
hdsize/8 for the v2.

> 
> [0] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#advanced_lvm_options
> 
>> [..]
>> diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
>> index d6bc6e3..85a1f52 100644
>> --- a/proxmox-auto-installer/src/utils.rs
>> +++ b/proxmox-auto-installer/src/utils.rs
>> @@ -396,6 +396,19 @@ pub fn verify_disks_settings(answer: &Answer) -> Result<()> {
>>               );
>>           }
>>       }
>> +
>> +    if let answer::FsOptions::LVM(lvm) = &answer.disks.fs_options {
>> +        if lvm.swapsize > lvm.hdsize {
>> +            bail!("LVM swapsize cannot be greater than hdsize");
>> +        }
>> +
>> +        if let Some((maxroot, hdsize)) = lvm.maxroot.zip(lvm.hdsize) {
>> +            if maxroot > hdsize / 4.0 {
>> +                bail!("LVM maxroot cannot be greater than hdsize / 4");
>> +            }
>> +        }
>> +    }
> 
> If feasible, could these checks be de-duplicated with the ones below?
> Since they do check the exact same things.

I added 2 check functions (swap and maxroot) that are used by both the 
autoinstaller utils and in the installer-common disk_checks for the v2. 
Thanks for the suggestion!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2025-04-29 11:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 16:27 [pve-devel] [PATCH installer 0/6] add early disk and network sanity checks Michael Köppl
2025-04-22 16:27 ` [pve-devel] [PATCH pve-installer 1/6] auto: add early answer file sanity check for RAID configurations Michael Köppl
2025-04-28 11:25   ` Christoph Heiss
2025-04-28 14:31     ` Michael Köppl
2025-04-29  8:26       ` Christoph Heiss
2025-04-29  9:32         ` Michael Köppl
2025-04-29  9:40           ` Christoph Heiss
2025-04-22 16:27 ` [pve-devel] [PATCH pve-installer 2/6] common: use get_min_disks as single source of truth for RAID config checks Michael Köppl
2025-04-28 11:48   ` Christoph Heiss
2025-04-28 15:36     ` Michael Köppl
2025-04-22 16:27 ` [pve-devel] [RFC PATCH pve-installer 3/6] close #5887: add sanity check for LVM swapsize and maxroot Michael Köppl
2025-04-28 12:00   ` Christoph Heiss
2025-04-29 11:30     ` Michael Köppl [this message]
2025-04-22 16:27 ` [pve-devel] [PATCH pve-installer 4/6] run rustfmt Michael Köppl
2025-04-23 11:56   ` Christoph Heiss
2025-04-25 12:22     ` Michael Köppl
2025-04-22 16:27 ` [pve-devel] [PATCH pve-installer 5/6] common: add more descriptive errors for invalid network configs Michael Köppl
2025-04-28 12:20   ` Christoph Heiss
2025-04-22 16:27 ` [pve-devel] [RFC PATCH pve-installer 6/6] closes #5757: common: add checks for valid IPv4 address within subnet Michael Köppl
2025-04-28 10:22   ` Christoph Heiss
2025-04-28 14:20     ` Michael Köppl
2025-04-28 12:25 ` [pve-devel] [PATCH installer 0/6] add early disk and network sanity checks Christoph Heiss
2025-04-29 14:14   ` Michael Köppl

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=7fbf581b-0988-47ab-b91a-1feb21b4c4cf@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal