[pve-devel] [RFC/PATCH installer 2/4] add entry for swapsize to ZFS advanced widget

Stoiko Ivanov s.ivanov at proxmox.com
Mon Oct 1 12:41:59 CEST 2018


and save the set value as separate key in $config_options to prevent
deletion from main window

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxinstall | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/proxinstall b/proxinstall
index adba44f..43ac5d2 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1213,11 +1213,12 @@ sub extract_data {
 
 	    zfs_create_rpool($vdev);
 
+	    my $set_swapsize = $config_options->{zfsswapsize} // $config_options->{swapsize};
+	    $config_options->{swapsize} = $set_swapsize;
 	    my $swap_size;
-	    $swap_size = compute_swapsize($disksize) if defined($config_options->{swapsize};
+	    $swap_size = compute_swapsize($disksize) if defined($set_swapsize);
 
 	    $swapfile = zfs_create_swap($swap_size) if $swap_size;
-
 	} else {
 
 	    die "target '$target_hd' is not a valid block device\n" if ! -b $target_hd;
@@ -2633,6 +2634,16 @@ my $create_raid_advanced_grid = sub {
     $spinbutton_copies->set_value($config_options->{copies});
     push @$labeled_widgets, "copies", $spinbutton_copies;
 
+    my $entry_swapsize = Gtk3::Entry->new();
+    $entry_swapsize->set_tooltip_text("maximum SWAP size (GB)");
+    $entry_swapsize->signal_connect (changed => sub{
+	my $w = shift;
+	$config_options->{zfsswapsize} = $w->get_text();
+    });
+    my $current_swapsize = $config_options->{zfsswapsize} // $config_options->{swapsize};
+    $entry_swapsize->set_text($current_swapsize) if defined($current_swapsize);
+    push @$labeled_widgets, "swapsize", $entry_swapsize;
+
     return &$create_label_widget_grid($labeled_widgets);;
 };
 
-- 
2.11.0





More information about the pve-devel mailing list