From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C53231FF16F for ; Tue, 14 Oct 2025 11:47:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4B04625937; Tue, 14 Oct 2025 11:47:43 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Date: Tue, 14 Oct 2025 11:47:20 +0200 Message-ID: <20251014094739.209924-3-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251014094739.209924-1-m.sandoval@proxmox.com> References: <20251014094739.209924-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760435222595 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.098 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [rthardware.pm] Subject: [pve-devel] [PATCH ha-manager 2/9] sim: add UI to set resource stats for new guests 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Adds a dialog which allow setting the maxmemory and maxcpu of an existing HA service. Signed-off-by: Maximiliano Sandoval --- src/PVE/HA/Sim/RTHardware.pm | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/PVE/HA/Sim/RTHardware.pm b/src/PVE/HA/Sim/RTHardware.pm index 0dfe0b2..28c756e 100644 --- a/src/PVE/HA/Sim/RTHardware.pm +++ b/src/PVE/HA/Sim/RTHardware.pm @@ -24,6 +24,9 @@ use PVE::HA::LRM; use PVE::HA::Sim::RTEnv; use base qw(PVE::HA::Sim::Hardware); +my $DEFAULT_MAXMEM = 4096; +my $DEFAULT_MAXCPU = 4; + sub new { my ($this, $testdir) = @_; @@ -434,8 +437,41 @@ sub show_service_add_dialog { $node_cb->set_active(0); $grid->attach($node_cb, 2, 1, 1, 1); + my $cpu_label = Gtk3::Label->new('CPU Count'); + $cpu_label->set_hexpand(1); + $cpu_label->set_xalign(0); + + my $cpu_count_spin = Gtk3::SpinButton->new_with_range(1.0, 1024, 1.0); + $cpu_count_spin->set_value($DEFAULT_MAXCPU); + + my $cpu_box = Gtk3::Box->new('horizontal', 6); + $cpu_box->add($cpu_label); + $cpu_box->add($cpu_count_spin); + + my $memory_label = Gtk3::Label->new('Memory (MiB)'); + $memory_label->set_hexpand(1); + $memory_label->set_xalign(0); + + # There is an arbitrary limit of 10 TiB + my $memory_spin = Gtk3::SpinButton->new_with_range(1.0, 10485760.0, 1.0); + $memory_spin->set_value($DEFAULT_MAXMEM); + + my $memory_box = Gtk3::Box->new('horizontal', 6); + $memory_box->add($memory_label); + $memory_box->add($memory_spin); + + my $vbox = Gtk3::Box->new('vertical', 6); + $vbox->set_margin_start(6); + $vbox->set_margin_end(6); + $vbox->set_margin_top(6); + $vbox->set_margin_bottom(6); + $vbox->add($grid); + $vbox->add($cpu_box); + $vbox->add($memory_box); + $vbox->show_all(); + my $contarea = $dialog->get_content_area(); - $contarea->add($grid); + $contarea->add($vbox); $dialog->show_all(); my $res = $dialog->run(); @@ -443,6 +479,11 @@ sub show_service_add_dialog { if (defined($res) && $res eq 'ok') { my $sid = "$service_type:$service_id"; $self->sim_hardware_cmd("service $sid add $service_node", 'command'); + + my $maxcpu = $cpu_count_spin->get_value(); + my $maxmemory = $memory_spin->get_value(); + $self->sim_hardware_cmd("service $sid set-static-stats $maxcpu $maxmemory", 'command'); + $self->add_service_to_gui($sid); } -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel