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 935A51FF16F for ; Tue, 14 Oct 2025 11:48:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DC2DB25ADD; Tue, 14 Oct 2025 11:47:45 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Date: Tue, 14 Oct 2025 11:47:23 +0200 Message-ID: <20251014094739.209924-6-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: 1760435222685 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.099 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 Subject: [pve-devel] [PATCH ha-manager 5/9] sim: allow configuring datacenter configuration 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" Signed-off-by: Maximiliano Sandoval --- src/PVE/HA/Sim/RTHardware.pm | 60 +++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/PVE/HA/Sim/RTHardware.pm b/src/PVE/HA/Sim/RTHardware.pm index e46cb91..5b7c765 100644 --- a/src/PVE/HA/Sim/RTHardware.pm +++ b/src/PVE/HA/Sim/RTHardware.pm @@ -290,6 +290,56 @@ sub set_network_state { $self->sim_hardware_cmd("network $node $action"); } +sub create_datacenter_control { + my ($self) = @_; + + my $active = 0; + my $initial_conf = $self->read_datacenter_conf(); + if (my $crs = $initial_conf->{crs}) { + if (my $ha = $crs->{ha}) { + $active = 1 if $ha eq 'static'; + } + } + + my $crs_types = ['basic', 'static']; + + my $label = Gtk3::Label->new('Cluster Resource Scheduler'); + $label->set_hexpand(1); + $label->set_xalign(0.0); + + my $crs_combo = Gtk3::ComboBoxText->new(); + $crs_combo->set_valign('center'); + foreach my $type (@$crs_types) { + $crs_combo->append_text($type); + } + $crs_combo->set_active($active); + $crs_combo->signal_connect( + 'notify::active' => sub { + my $combo = shift; + + my $active = $combo->get_active(); + return if $active < 0; + + my $ha_type = $crs_types->[$active]; + + my $conf = $self->read_datacenter_conf(); + $conf->{crs}->{ha} = $ha_type; + $self->write_datacenter_conf($conf); + }, + ); + + my $hbox = Gtk3::Box->new('horizontal', 0); + $hbox->set_margin_start(6); + $hbox->set_margin_end(6); + $hbox->set_margin_top(6); + $hbox->set_margin_bottom(6); + $hbox->add($label); + $hbox->add($crs_combo); + $hbox->show_all(); + + return $hbox; +} + sub create_node_control { my ($self) = @_; @@ -854,10 +904,18 @@ sub create_main_window { my $vbox = Gtk3::VBox->new(0, 0); $grid->attach($vbox, 1, 0, 1, 1); + my $datacenter_control = $self->create_datacenter_control(); + $vbox->pack_start($datacenter_control, 0, 0, 0); + + my $sep = Gtk3::Separator->new('horizontal'); + $sep->set('margin-top', 10); + $sep->set_vexpand(0); + $vbox->pack_start($sep, 0, 0, 0); + my $ngrid = $self->create_node_control(); $vbox->pack_start($ngrid, 0, 0, 0); - my $sep = Gtk3::HSeparator->new; + $sep = Gtk3::Separator->new('horizontal'); $sep->set('margin-top', 10); $vbox->pack_start($sep, 0, 0, 0); -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel