From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ha-manager 5/9] sim: allow configuring datacenter configuration
Date: Tue, 14 Oct 2025 11:47:23 +0200 [thread overview]
Message-ID: <20251014094739.209924-6-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20251014094739.209924-1-m.sandoval@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
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
next prev parent reply other threads:[~2025-10-14 9:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 9:47 [pve-devel] [PATCH ha-manager 0/9] allow setting crs and service static resources Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 1/9] sim: add command to set static service stats Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 2/9] sim: add UI to set resource stats for new guests Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 3/9] sim: allow editing static resources of resource Maximiliano Sandoval
2025-10-14 10:00 ` Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 4/9] sim: add helper to store datacenter configuration Maximiliano Sandoval
2025-10-14 9:47 ` Maximiliano Sandoval [this message]
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 6/9] sim: add method to persist current state Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 7/9] sim: add button to persist state to header bar Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 8/9] sim: set default cpu count and memory on new nodes Maximiliano Sandoval
2025-10-14 9:47 ` [pve-devel] [PATCH ha-manager 9/9] gitignore: ignore build directory Maximiliano Sandoval
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=20251014094739.209924-6-m.sandoval@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