* [pve-devel] [PATCH installer 1/3] perform early check on hdsize
@ 2023-11-21 13:20 Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 2/3] set correct maximum for hdsize input Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 3/3] only set hdsize when deviating from the maximum Folke Gleumes
0 siblings, 2 replies; 3+ messages in thread
From: Folke Gleumes @ 2023-11-21 13:20 UTC (permalink / raw)
To: pve-devel
until now it was only checked at install time, failing the whole
installation
Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
---
proxinstall | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/proxinstall b/proxinstall
index 01d4cfe..cf8f510 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1526,6 +1526,12 @@ sub create_hdsel_view {
$target_hds = [ $target_hd ];
}
+ my $hdsize = Proxmox::Install::Config::get_hdsize();
+ if (defined $hdsize && $hdsize < 2.0) {
+ Proxmox::UI::message("Warning: A minimum disk size of 2.0GB is expected.\n");
+ return;
+ }
+
$step_number++;
create_country_view();
});
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH installer 2/3] set correct maximum for hdsize input
2023-11-21 13:20 [pve-devel] [PATCH installer 1/3] perform early check on hdsize Folke Gleumes
@ 2023-11-21 13:20 ` Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 3/3] only set hdsize when deviating from the maximum Folke Gleumes
1 sibling, 0 replies; 3+ messages in thread
From: Folke Gleumes @ 2023-11-21 13:20 UTC (permalink / raw)
To: pve-devel
previously, when opening the dialog multiple times, the maximum was
determined by the previous set value, not the maxium possible for the
storage
Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
---
proxinstall | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/proxinstall b/proxinstall
index cf8f510..4fc31f8 100755
--- a/proxinstall
+++ b/proxinstall
@@ -985,14 +985,11 @@ my $create_label_widget_grid = sub {
return $grid;
};
-# only relevant for raid with its multipl diskX to diskY mappings.
-my $get_selected_hdsize = sub {
- my $hdsize = shift;
- return $hdsize if defined($hdsize);
-
- # compute the smallest disk size of the actually selected disks
+# only returns a value when using raid, undef otherwise
+my $get_max_hdsize = sub {
my $cached_disks = get_cached_disks();
my $disk_count = scalar(@$cached_disks);
+ my $hdsize;
for (my $i = 0; $i < $disk_count; $i++) {
my $cur_hd = $gtk_state->{disk_selection}->{$i} // next;
my $disksize = int(@$cur_hd[2] / (2 * 1024 * 1024.0)); # size in GB
@@ -1000,6 +997,16 @@ my $get_selected_hdsize = sub {
$hdsize = $disksize if $disksize < $hdsize;
}
+ return $hdsize;
+};
+
+# only relevant for raid with its multipl diskX to diskY mappings.
+my $get_selected_hdsize = sub {
+ my $hdsize = shift;
+ return $hdsize if defined($hdsize);
+
+ $hdsize = $get_max_hdsize->();
+
if (my $cfg_hdsize = Proxmox::Install::Config::get_hdsize()) {
# had the dialog open previously and set an even lower size than the disk selection allows
$hdsize = $cfg_hdsize if $cfg_hdsize < $hdsize;
@@ -1011,17 +1018,19 @@ my sub update_hdsize_adjustment {
my ($adjustment, $hdsize) = @_;
$hdsize = $get_selected_hdsize->($hdsize);
+ my $max_hdsize = $get_max_hdsize->() // $hdsize;
# expect that lower = 0 and step increments = 1 still are valid
- $adjustment->set_upper($hdsize + 1);
+ $adjustment->set_upper($max_hdsize + 1);
$adjustment->set_value($hdsize);
}
my sub create_hdsize_adjustment {
my ($hdsize) = @_;
$hdsize = $get_selected_hdsize->($hdsize);
+ my $max_hdsize = $get_max_hdsize->() // $hdsize;
my $cfg_hdsize = Proxmox::Install::Config::get_hdsize();
# params are: initial value, lower, upper, step increment, page increment, page size
- return Gtk3::Adjustment->new($cfg_hdsize || $hdsize, 0, $hdsize+1, 1, 1, 1);
+ return Gtk3::Adjustment->new($cfg_hdsize || $hdsize, 0, $max_hdsize+1, 1, 1, 1);
}
my sub get_hdsize_spin_button {
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH installer 3/3] only set hdsize when deviating from the maximum
2023-11-21 13:20 [pve-devel] [PATCH installer 1/3] perform early check on hdsize Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 2/3] set correct maximum for hdsize input Folke Gleumes
@ 2023-11-21 13:20 ` Folke Gleumes
1 sibling, 0 replies; 3+ messages in thread
From: Folke Gleumes @ 2023-11-21 13:20 UTC (permalink / raw)
To: pve-devel
this prevents a lower hdsize to be set, when intermittently adding a
smaller storage device.
Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
---
proxinstall | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/proxinstall b/proxinstall
index 4fc31f8..695826d 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1409,7 +1409,10 @@ sub create_hdoption_view {
my $tmp;
- if (($tmp = &$get_float($spinbutton_hdsize)) && ($tmp != $hdsize)) {
+ if (
+ ($tmp = &$get_float($spinbutton_hdsize)) && ($tmp != $hdsize)
+ && ($tmp != $get_max_hdsize->())
+ ) {
Proxmox::Install::Config::set_hdsize($tmp);
} else {
Proxmox::Install::Config::set_hdsize(undef);
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-21 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 13:20 [pve-devel] [PATCH installer 1/3] perform early check on hdsize Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 2/3] set correct maximum for hdsize input Folke Gleumes
2023-11-21 13:20 ` [pve-devel] [PATCH installer 3/3] only set hdsize when deviating from the maximum Folke Gleumes
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