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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5C00494EE2 for ; Fri, 23 Feb 2024 16:48:20 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 419C51B669 for ; Fri, 23 Feb 2024 16:48:20 +0100 (CET) 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 for ; Fri, 23 Feb 2024 16:48:19 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4D92E44E09 for ; Fri, 23 Feb 2024 16:48:19 +0100 (CET) References: <20240207142824.2613933-1-c.heiss@proxmox.com> <20240207142824.2613933-4-c.heiss@proxmox.com> User-agent: mu4e 1.10.8; emacs 29.1 From: Maximiliano Sandoval To: Proxmox VE development discussion Date: Fri, 23 Feb 2024 16:37:16 +0100 In-reply-to: <20240207142824.2613933-4-c.heiss@proxmox.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-SPAM-LEVEL: Spam detection results: 0 AWL 0.019 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [gtk.org] Subject: Re: [pve-devel] [PATCH installer v2 3/3] proxinstall: expose arc size setting for zfs bootdisks for all products 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: Fri, 23 Feb 2024 15:48:20 -0000 Some comments bellow. Christoph Heiss 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 > --- > ... > ... > + > + # 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