From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0B3E61FF16F for ; Tue, 14 Oct 2025 12:00:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7D06D26A74; Tue, 14 Oct 2025 12:00:55 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com In-Reply-To: <20251014094739.209924-4-m.sandoval@proxmox.com> (Maximiliano Sandoval's message of "Tue, 14 Oct 2025 11:47:21 +0200") References: <20251014094739.209924-1-m.sandoval@proxmox.com> <20251014094739.209924-4-m.sandoval@proxmox.com> User-Agent: mu4e 1.12.9; emacs 30.1 Date: Tue, 14 Oct 2025 12:00:52 +0200 Message-ID: MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760436016099 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: Re: [pve-devel] [PATCH ha-manager 3/9] sim: allow editing static resources of resource 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" Maximiliano Sandoval writes: > Signed-off-by: Maximiliano Sandoval > --- > src/PVE/HA/Sim/RTHardware.pm | 82 +++++++++++++++++++++++++++++++++++- > 1 file changed, 80 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/HA/Sim/RTHardware.pm b/src/PVE/HA/Sim/RTHardware.pm > index 28c756e..e46cb91 100644 > --- a/src/PVE/HA/Sim/RTHardware.pm > +++ b/src/PVE/HA/Sim/RTHardware.pm > @@ -490,6 +490,75 @@ sub show_service_add_dialog { > $dialog->destroy(); > } > > +sub show_service_edit_dialog { > + my ($self, $sid) = @_; > + > + my $stats = $self->read_static_service_stats(); > + my $resource_stats = $stats->{$sid} > + // { maxcpu => $DEFAULT_MAXCPU, maxmemory => $DEFAULT_MAXMEM }; > + > + 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($resource_stats->{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($resource_stats->{maxmemory}); > + > + 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->add($cpu_box); > + $vbox->add($memory_box); > + > + my $dialog = Gtk3::Dialog->new(); > + > + $dialog->set_title("Migrate $sid"); This should be Edit instead. > + $dialog->set_modal(1); > + $dialog->set_transient_for($self->{main_window}); > + > + $dialog->add_button("_OK", 'ok'); > + > + my $content_area = $dialog->get_content_area(); > + $content_area->add($vbox); > + $vbox->set_margin_start(12); > + $vbox->set_margin_end(12); > + $vbox->set_margin_top(12); > + $vbox->set_margin_bottom(12); > + > + $dialog->show_all(); > + > + $dialog->signal_connect( > + 'response' => sub { > + my ($dialog, $response) = @_; > + > + if ($response eq 'ok') { > + $self->set_static_service_stats( > + $sid, > + { > + maxcpu => $cpu_count_spin->get_value(), > + maxmemory => $memory_spin->get_value(), > + }, > + ); > + } > + $dialog->close(); > + }, > + ); > +} > + > sub show_service_delete_dialog { > my ($self, $sid) = @_; > > @@ -659,8 +728,17 @@ sub new_service_gui_entry { > $sgrid->attach($w, 4, $row, 1, 1); > $self->{service_gui}->{$sid}->{status_label} = $w; > > + my $edit_button = Gtk3::Button->new_from_icon_name('document-edit', 1); > + $edit_button->set_tooltip_text('Edit static resources'); > + $sgrid->attach($edit_button, 5, $row, 1, 1); > + $edit_button->signal_connect( > + clicked => sub { > + $self->show_service_edit_dialog($sid); > + }, > + ); > + > $w = Gtk3::Button->new_from_icon_name('edit-delete', 1); > - $sgrid->attach($w, 5, $row, 1, 1); > + $sgrid->attach($w, 6, $row, 1, 1); > $w->signal_connect( > clicked => sub { > $self->show_service_delete_dialog($sid); > @@ -699,7 +777,7 @@ sub create_service_control { > } > > $w = Gtk3::Button->new_from_icon_name('list-add', 1); > - $sgrid->attach($w, 5, $row, 1, 1); > + $sgrid->attach($w, 6, $row, 1, 1); > $w->signal_connect( > clicked => sub { > $self->show_service_add_dialog(); -- Maximiliano _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel