public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer 1/2] align metadatasize to 4 MiB
@ 2023-06-22 14:18 Fiona Ebner
  2023-06-22 14:18 ` [pve-devel] [PATCH installer 2/2] always align rootdisk size " Fiona Ebner
  2023-06-22 14:29 ` [pve-devel] applied: [PATCH installer 1/2] align metadatasize " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fiona Ebner @ 2023-06-22 14:18 UTC (permalink / raw)
  To: pve-devel

First step towards fixing an issue reported in the community forum [0]
where using 250.00 hdsize, 250 maxroot and 0 minfree would fail.

Turns out two extents would be missing because of lvcreate implicitly
rounding up, one of them for the metadata.

[0]: https://forum.proxmox.com/threads/129320/post-566375

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 Proxmox/Install.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 7970f83..c2c014d 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -469,9 +469,10 @@ sub create_lvm_volumes {
 	die "unable to create root volume\n";
 
     if ($datasize > 4 * 1024 * 1024) {
-	my $metadatasize = $datasize/100; # default 1% of data
+	my $metadatasize = int($datasize/100); # default 1% of data
 	$metadatasize = 1024*1024 if $metadatasize < 1024*1024; # but at least 1G
 	$metadatasize = 16*1024*1024 if $metadatasize > 16*1024*1024; # but at most 16G
+	$metadatasize &= ~0xFFF; # align down to 4 MB boundaries
 
 	# otherwise the metadata is taken out of $minfree
 	$datasize -= 2 * $metadatasize;
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH installer 2/2] always align rootdisk size to 4 MiB
  2023-06-22 14:18 [pve-devel] [PATCH installer 1/2] align metadatasize to 4 MiB Fiona Ebner
@ 2023-06-22 14:18 ` Fiona Ebner
  2023-06-22 14:29 ` [pve-devel] applied: [PATCH installer 1/2] align metadatasize " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2023-06-22 14:18 UTC (permalink / raw)
  To: pve-devel

While this was already done in the $rest < 48 GiB cases, it wasn't yet
done for the else branch and also not if $maxroot_mb was assigned,
because of being smaller.

Second and last step towards fixing an issue reported in the community
forum [0] where using 250.00 hdsize, 250 maxroot and 0 minfree would
fail.

Turns out two extents would be missing because of lvcreate implicitly
rounding up, one of them for the root LV (the one for metadata was
already handled in the previous commit).

[0]: https://forum.proxmox.com/threads/129320/post-566375

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

I think it'd be possible to drop the alignments in the branches now,
but let's fix the issue for now and tackle improving/reworking the
logic more for later.

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

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index c2c014d..25031f8 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -435,6 +435,7 @@ sub create_lvm_volumes {
 
 	$rootsize_mb = $maxroot_mb if $rootsize_mb > $maxroot_mb;
 	$rootsize = int($rootsize_mb * 1024);
+	$rootsize &= ~0xFFF; # align down to 4 MB boundaries
 
 	$rest -= $rootsize; # in KB
 
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH installer 1/2] align metadatasize to 4 MiB
  2023-06-22 14:18 [pve-devel] [PATCH installer 1/2] align metadatasize to 4 MiB Fiona Ebner
  2023-06-22 14:18 ` [pve-devel] [PATCH installer 2/2] always align rootdisk size " Fiona Ebner
@ 2023-06-22 14:29 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-06-22 14:29 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 22/06/2023 um 16:18 schrieb Fiona Ebner:
> First step towards fixing an issue reported in the community forum [0]
> where using 250.00 hdsize, 250 maxroot and 0 minfree would fail.
> 
> Turns out two extents would be missing because of lvcreate implicitly
> rounding up, one of them for the metadata.
> 
> [0]: https://forum.proxmox.com/threads/129320/post-566375
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  Proxmox/Install.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-22 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22 14:18 [pve-devel] [PATCH installer 1/2] align metadatasize to 4 MiB Fiona Ebner
2023-06-22 14:18 ` [pve-devel] [PATCH installer 2/2] always align rootdisk size " Fiona Ebner
2023-06-22 14:29 ` [pve-devel] applied: [PATCH installer 1/2] align metadatasize " Thomas Lamprecht

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