all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] fix space calculation for small disks for pve product
Date: Thu, 22 Jun 2023 15:57:13 +0200	[thread overview]
Message-ID: <20230622135713.1326873-1-s.ivanov@proxmox.com> (raw)

The convoluted calculation logic in case the disks is 8GB leads to
datasize becoming 16EiB further down:
* after calculating and removing the rootsize from $rest, $rest becomes
  smaller than $space (which should be the minimal non-used space in the
  volume-group) - this leads to a negative value, which overflows in
  the `& ~0xFFF` opration.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
tested in a VM with an 8GB disk

 Proxmox/Install.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 7970f83..28add10 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -425,7 +425,7 @@ sub create_lvm_volumes {
 	my $rootsize_mb;
 	if ($rest_mb < 12 * 1024) {
 	    # no point in wasting space, try to get us actually installed and align down to 4 MB
-	    $rootsize_mb = ($rest_mb - 0.1) & ~3;
+	    $rootsize_mb = ($rest_mb - 4) & ~3;
 	} elsif ($rest_mb < 48 * 1024) {
 	    my $masked = int($rest_mb / 2) & ~3; # align down to 4 MB
 	    $rootsize_mb = $masked;
-- 
2.30.2





             reply	other threads:[~2023-06-22 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 13:57 Stoiko Ivanov [this message]
2023-06-22 14:29 ` [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=20230622135713.1326873-1-s.ivanov@proxmox.com \
    --to=s.ivanov@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