public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk
@ 2025-07-16 13:25 Shannon Sterz
  2025-07-16 23:28 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Shannon Sterz @ 2025-07-16 13:25 UTC (permalink / raw)
  To: pve-devel

assuming 'single' mode if the user selects exactely one disk can lead
to unexpected results. for example, if a user sets up a raid10 with
one disk, the installer will happily install it as a 'single' install.
doing the same with two disks fails with an error that for raid10 at
least 4 disks are required.

this is also inconsistent with the tui installer that will always
complain about the amount of disks not being correct.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 Proxmox/Install.pm | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 1689097..3159dcc 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -363,20 +363,16 @@ sub get_btrfs_raid_setup {
 
     my $mode;
 
-    if ($diskcount == 1) {
-        $mode = 'single';
+    if ($filesys eq 'btrfs (RAID0)') {
+        $mode = 'raid0';
+    } elsif ($filesys eq 'btrfs (RAID1)') {
+        die "$filesys: need at least 2 devices\n" if $diskcount < 2;
+        $mode = 'raid1';
+    } elsif ($filesys eq 'btrfs (RAID10)') {
+        die "$filesys: need at least 4 devices\n" if $diskcount < 4;
+        $mode = 'raid10';
     } else {
-        if ($filesys eq 'btrfs (RAID0)') {
-            $mode = 'raid0';
-        } elsif ($filesys eq 'btrfs (RAID1)') {
-            die "$filesys: need at least 2 devices\n" if $diskcount < 2;
-            $mode = 'raid1';
-        } elsif ($filesys eq 'btrfs (RAID10)') {
-            die "$filesys: need at least 4 devices\n" if $diskcount < 4;
-            $mode = 'raid10';
-        } else {
-            die "unknown btrfs mode '$filesys'\n";
-        }
+        die "unknown btrfs mode '$filesys'\n";
     }
 
     return ($devlist, $mode);
-- 
2.39.5



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


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

* [pve-devel] applied: [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk
  2025-07-16 13:25 [pve-devel] [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk Shannon Sterz
@ 2025-07-16 23:28 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-07-16 23:28 UTC (permalink / raw)
  To: pve-devel, Shannon Sterz

On Wed, 16 Jul 2025 15:25:57 +0200, Shannon Sterz wrote:
> assuming 'single' mode if the user selects exactely one disk can lead
> to unexpected results. for example, if a user sets up a raid10 with
> one disk, the installer will happily install it as a 'single' install.
> doing the same with two disks fails with an error that for raid10 at
> least 4 disks are required.
> 
> this is also inconsistent with the tui installer that will always
> complain about the amount of disks not being correct.
> 
> [...]

Applied, thanks!

[1/1] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk
      commit: 02818f46ea4da54c1b0795efcfbd0fcc4464bb3f


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


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

end of thread, other threads:[~2025-07-16 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-16 13:25 [pve-devel] [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk Shannon Sterz
2025-07-16 23:28 ` [pve-devel] applied: " 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