[pve-devel] [RFC installer] fix weird behavior with hdsel screen

Oguz Bektas o.bektas at proxmox.com
Thu Jan 24 14:31:18 CET 2019


* we don't want the hd select combobox to show up when user goes back
after choosing raid during initial setup

* fix the problem where the chosen disk is not displayed correctly in
the acknowledgement screen

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 proxinstall | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/proxinstall b/proxinstall
index 3c37239..000be0d 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2555,7 +2555,7 @@ sub create_country_view {
 my $target_hd_combo;
 my $target_hd_label;
 
-my $hdopion_first_setup = 1;
+my $hdoption_first_setup = 1;
 
 my $create_basic_grid = sub {
     my $grid =  Gtk3::Grid->new();
@@ -2611,7 +2611,7 @@ my $create_raid_disk_grid = sub {
 	    });
 	}
 
-	if ($hdopion_first_setup) {
+	if ($hdoption_first_setup) {
 	    $disk_selector->set_active ($i+1) if $hds->[$i];
 	} else {
 	    my $hdind = 0;
@@ -2834,7 +2834,7 @@ sub create_hdoption_view {
     $grid->attach($options_stack, 0, $row, 2, 1);
     $row++;
 
-    $hdopion_first_setup = 0;
+    $hdoption_first_setup = 0;
 
     my $switch_view = sub {
 	my $raid = $config_options->{filesys} =~ m/zfs|btrfs/;
@@ -3043,7 +3043,7 @@ sub create_hdsel_view {
     $vbox->pack_start($hbox, 0, 0, 10);
 
     my ($disk, $devname, $size, $model) = @{@$hds[0]};
-    $target_hd = $devname;
+    $target_hd = $devname if !defined($target_hd);
 
     $target_hd_label = Gtk3::Label->new("Target Harddisk: ");
     $hbox->pack_start($target_hd_label, 0, 0, 0);
@@ -3055,9 +3055,16 @@ sub create_hdsel_view {
 	$target_hd_combo->append_text (get_device_desc($devname, $size, $model));
     }
 
-    $target_hd_combo->set_active(0);
+    my $raid = $config_options->{filesys} =~ m/zfs|btrfs/;
+    if ($raid) {
+	$target_hd_label->set_text("Target: $config_options->{filesys} ");
+	$target_hd_combo->set_visible(0);
+	$target_hd_combo->set_no_show_all(1);
+    }
+    $target_hd_combo->set_active($config_options->{chosen_hd} // 0);
     $target_hd_combo->signal_connect(changed => sub {
 	$a = shift->get_active;
+	$config_options->{chosen_hd} = $a;
 	my ($disk, $devname) = @{@$hds[$a]};
 	$target_hd = $devname;
     });
-- 
2.11.0





More information about the pve-devel mailing list