From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B8D15DAD5 for ; Tue, 19 Apr 2022 14:02:44 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B6FB8279E1 for ; Tue, 19 Apr 2022 14:02:44 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 5DBC1279C3 for ; Tue, 19 Apr 2022 14:02:43 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id ACC4C42242 for ; Tue, 19 Apr 2022 14:02:42 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Tue, 19 Apr 2022 14:02:31 +0200 Message-Id: <20220419120231.2161474-3-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220419120231.2161474-1-s.ivanov@proxmox.com> References: <20220419120231.2161474-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.208 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH installer 2/2] fix #3587: make hdsize configurable for btrfs setups X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2022 12:02:44 -0000 as described in the bug-entry it is still not possible to have a swapfile on general btrfs setups (only on single disk (single data profile - documented in [0,1], and my quick tests confirmed it). Users who still need/want swap can now set a hdsize smaller than their disk-size to keep a part unpartitioned for adding a swap-partition after installation (like with ZFS). I quickly considered sticking with a single 'advanced raid' tab and adapting the visibility of the individual lines, but did not see an elegant way (as far as this is possible with GUI code) of doing that. Signed-off-by: Stoiko Ivanov --- proxinstall | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/proxinstall b/proxinstall index 5360b08..93f2443 100755 --- a/proxinstall +++ b/proxinstall @@ -1341,7 +1341,7 @@ sub extract_data { my $logical_bsize = @$hd[4]; my ($size, $osdev, $efidev) = - partition_bootable_disk($devname, undef, '8300'); + partition_bootable_disk($devname, $config_options->{hdsize}, '8300'); $rootdev = $osdev if !defined($rootdev); # simply point to first disk my $by_id = find_stable_path("/dev/disk/by-id", $devname); push @$bootdevinfo, { @@ -2983,7 +2983,7 @@ my $get_hdsize_spinbtn = sub { }; my $create_raid_disk_grid = sub { - my ($hdsize_btn) = @_; + my ($hdsize_buttons) = @_; my $hd_count = scalar(@$hds); my $disk_labeled_widgets = []; for (my $i = 0; $i < $hd_count; $i++) { @@ -3001,7 +3001,9 @@ my $create_raid_disk_grid = sub { my $a = $w->get_active - 1; $config_options->{"disksel${diskid}"} = ($a >= 0) ? $hds->[$a] : undef; my $hdsize_adj = $get_hdsize_adjustment->(); - $hdsize_btn->set_adjustment($hdsize_adj); + for my $btn (@$hdsize_buttons) { + $btn->set_adjustment($hdsize_adj); + } }); } @@ -3115,6 +3117,13 @@ my $create_raid_advanced_grid = sub { return $create_label_widget_grid->($labeled_widgets);; }; +my $create_btrfs_raid_advanced_grid = sub { + my ($hdsize_btn) = @_; + my $labeled_widgets = []; + push @$labeled_widgets, "hdsize", $hdsize_btn; + return $create_label_widget_grid->($labeled_widgets);; +}; + sub create_hdoption_view { my $dialog = Gtk3::Dialog->new(); @@ -3223,13 +3232,16 @@ sub create_hdoption_view { } my $spinbutton_hdsize_zfs = $get_hdsize_spinbtn->($hdsize); + my $spinbutton_hdsize_btrfs = $get_hdsize_spinbtn->($hdsize); + my $hdsize_buttons = [ $spinbutton_hdsize_zfs, $spinbutton_hdsize_btrfs ]; my $options_stack = Gtk3::Stack->new(); $options_stack->set_visible(1); $options_stack->set_hexpand(1); $options_stack->set_vexpand(1); - $options_stack->add_titled(&$create_raid_disk_grid($spinbutton_hdsize_zfs), "raiddisk", "Disk Setup"); + $options_stack->add_titled(&$create_raid_disk_grid($hdsize_buttons), "raiddisk", "Disk Setup"); $options_stack->add_titled(&$create_label_widget_grid($hdsize_labeled_widgets), "hdsize", "Size Options"); $options_stack->add_titled(&$create_raid_advanced_grid($spinbutton_hdsize_zfs), "raidzfsadvanced", "Advanced Options"); + $options_stack->add_titled(&$create_btrfs_raid_advanced_grid($spinbutton_hdsize_btrfs), "raidbtrfsadvanced", "Advanced Options"); $options_stack->set_visible_child_name("raiddisk"); my $options_stack_switcher = Gtk3::StackSwitcher->new(); $options_stack_switcher->set_halign('center'); @@ -3257,8 +3269,9 @@ sub create_hdoption_view { $hw_raid_note->set_markup($msg); } $hw_raid_note->set_visible($raid); - $options_stack_switcher->set_visible($is_zfs); + $options_stack_switcher->set_visible($raid); $options_stack->get_child_by_name("raidzfsadvanced")->set_visible($is_zfs); + $options_stack->get_child_by_name("raidbtrfsadvanced")->set_visible(!$is_zfs); if ($raid) { $target_hd_label->set_text("Target: $config_options->{filesys} "); $options_stack->set_visible_child_name("raiddisk"); @@ -3267,7 +3280,7 @@ sub create_hdoption_view { } if ($raid) { - $spinbutton_hdsize = $spinbutton_hdsize_zfs; + $spinbutton_hdsize = $is_zfs ? $spinbutton_hdsize_zfs : $spinbutton_hdsize_btrfs; } else { $spinbutton_hdsize = $spinbutton_hdsize_nonraid; } -- 2.30.2