all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk
Date: Wed, 16 Jul 2025 15:25:57 +0200	[thread overview]
Message-ID: <20250716132557.237727-1-s.sterz@proxmox.com> (raw)

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


             reply	other threads:[~2025-07-16 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 13:25 Shannon Sterz [this message]
2025-07-16 23:28 ` [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=20250716132557.237727-1-s.sterz@proxmox.com \
    --to=s.sterz@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