From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer v2 3/3] proxinstall: expose arc size setting for zfs bootdisks for all products
Date: Fri, 23 Feb 2024 16:37:16 +0100 [thread overview]
Message-ID: <s8owmqvtc5a.fsf@proxmox.com> (raw)
In-Reply-To: <20240207142824.2613933-4-c.heiss@proxmox.com>
Some comments bellow.
Christoph Heiss <c.heiss@proxmox.com> writes:
> For non-PVE products, simply use the ZFS defaults (aka. 50%) and leave
> unset, if the user never touches that setting.
>
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
> ...
> ...
> +
> + # GTKs SpinButton does not support a placeholder value, unfortunaly. That means we also
There is a typo on unfortunately. What exactly do you mean by a
placeholder value? Like the initial value? If so see comment bellow.
> + # have to set the value normally for non-PVE products, where the ZFS default should be used,
> + # in case the user does not explicitly set a value.
> + # But due to the signal-based nature of GTK, as long as the user never touches the spinbutton,
> + # `Proxmox::Install::Config::set_zfs_opt('arc_max', ..)` never gets called, thus the default
> + # value (which is 0 for non-PVE) won't get overwritten and no modprobe file is written.
> + if ($arc_max > 0) {
> $spinbutton_arc_max->set_value($arc_max);
> - push @$labeled_widgets, ['ARC max size', $spinbutton_arc_max, 'MiB'];
> + } else {
> + # .. but we need to display the "real" value to the user
> + $spinbutton_arc_max->set_value($total_memory * 0.5);
> }
>
> + # We need to connect the signal afterwards, to avoid triggering it using ->set_value() above.
>
Alternatively one could init the spin button with the correct values
e.g.
my $total_memory = Proxmox::Install::RunEnv::get('total_memory');
my $arc_max = Proxmox::Install::Config::get_zfs_opt('arc_max');
my $arc_max_value = $total_memory * 0.5;
$arc_max_value = $arc_max if $arc_max > 0;
my $arc_max_adjusment = Gtk3::Adjustment->new($arc_max_value, $Proxmox::Install::RunEnv::ZFS_ARC_MIN_SIZE_MIB, $total_memory, 1, 10, 0);
my $spinbutton_arc_max = Gtk3::SpinButton->new($arc_max_adjusment, 1, 0);
$spinbutton_arc_max->set_tooltip_text('Maximum ARC size in megabytes');
$spinbutton_arc_max->signal_connect('value-changed' => sub {
my $w = shift;
Proxmox::Install::Config::set_zfs_opt('arc_max', $w->get_value_as_int());
});
Here the numerical values 1, 10, 0, and 1, 0 come from a quick
inspection of the source for gtk_spin_button_new_with_range and
gtk_spin_button_new (in the docs [1, 2] there is a [src] link next to
the Description header).
[1] https://docs.gtk.org/gtk3/ctor.SpinButton.new.html
[2] https://docs.gtk.org/gtk3/ctor.SpinButton.new_with_range.html
> + $spinbutton_arc_max->signal_connect('value-changed' => sub {
> + my $w = shift;
> + Proxmox::Install::Config::set_zfs_opt('arc_max', $w->get_value_as_int());
> + });
> +
> + push @$labeled_widgets, ['ARC max size', $spinbutton_arc_max, 'MiB'];
> +
> push @$labeled_widgets, ['hdsize', $hdsize_btn, 'GB'];
> return $create_label_widget_grid->($labeled_widgets);;
> };
--
Maximiliano
next prev parent reply other threads:[~2024-02-23 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 14:28 [pve-devel] [PATCH installer v2 0/3] expose zfs arc size setting " Christoph Heiss
2024-02-07 14:28 ` [pve-devel] [PATCH installer v2 1/3] tui: NumericEditView: add optional placeholder value Christoph Heiss
2024-02-07 14:28 ` [pve-devel] [PATCH installer v2 2/3] tui: expose arc size setting for zfs bootdisks for all products Christoph Heiss
2024-02-07 14:28 ` [pve-devel] [PATCH installer v2 3/3] proxinstall: " Christoph Heiss
2024-02-23 15:37 ` Maximiliano Sandoval [this message]
2024-04-12 10:26 ` Christoph Heiss
2024-04-15 13:21 ` [pve-devel] [PATCH installer v2 0/3] expose zfs arc size setting " Christoph Heiss
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=s8owmqvtc5a.fsf@proxmox.com \
--to=m.sandoval@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox