all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [RFC ha-manager 0/5] make simulator standalone again
@ 2025-09-22 12:04 Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env Fabian Grünbichler
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

by moving PVE::Notify to the actual site where it is used, and adapting
the build parts to install PVE::HA::Usage::Basic and PVE::HA::Rules::*
in the simulator as well.

CRS is not supported for now, as that would require pulling in a lot
more parts of PVE into the dependency tree of the simulator..

Fabian Grünbichler (5):
  fix #6839: move PVE::Notify usage to "real" Env
  build: install PVE::HA::Rules::* in simulator as well
  scheduling: make static scheduling optional
  build: install PVE::HA::Usage::Basic in simulator as well
  sim: add Cluster.pm stub with completion stub

 src/PVE/HA/Env/PVE2.pm    |  5 +++++
 src/PVE/HA/Makefile       |  2 ++
 src/PVE/HA/Manager.pm     | 21 +++++++++++++++------
 src/PVE/HA/NodeStatus.pm  |  4 +---
 src/PVE/HA/Rules/Makefile |  8 +++++++-
 src/PVE/HA/Sim/Cluster.pm | 11 +++++++++++
 src/PVE/HA/Sim/Makefile   |  2 ++
 src/PVE/HA/Usage/Makefile |  8 +++++++-
 8 files changed, 50 insertions(+), 11 deletions(-)
 create mode 100644 src/PVE/HA/Sim/Cluster.pm

-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
@ 2025-09-22 12:04 ` Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 2/5] build: install PVE::HA::Rules::* in simulator as well Fabian Grünbichler
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

instead of doing it in PVE::NodeStatus, which is also pulled into the
simulator.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
alternatively, we could also use the $have_.. / require hack here?

 src/PVE/HA/Env/PVE2.pm   | 5 +++++
 src/PVE/HA/NodeStatus.pm | 4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index e76e86b..2cec6f2 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -261,6 +261,11 @@ sub log {
 sub send_notification {
     my ($self, $template_name, $template_data, $metadata_fields) = @_;
 
+    # set here to avoid pulling in notification stack in simulator
+    my $common_data = PVE::Notify::common_template_data();
+    for my $key (keys $common_data->%*) {
+        $template_data->{$key} = $common_data->{$key} if !$template_data->{$key};
+    }
     eval { PVE::Notify::error($template_name, $template_data, $metadata_fields); };
 
     $self->log("warning", "could not notify: $@") if $@;
diff --git a/src/PVE/HA/NodeStatus.pm b/src/PVE/HA/NodeStatus.pm
index 0d04cd5..1512ae2 100644
--- a/src/PVE/HA/NodeStatus.pm
+++ b/src/PVE/HA/NodeStatus.pm
@@ -3,8 +3,6 @@ package PVE::HA::NodeStatus;
 use strict;
 use warnings;
 
-use PVE::Notify;
-
 use JSON;
 
 my $fence_delay = 60;
@@ -195,7 +193,7 @@ my $send_fence_state_email = sub {
     my $haenv = $self->{haenv};
     my $status = $haenv->read_manager_status();
 
-    my $template_data = PVE::Notify::common_template_data();
+    my $template_data = {};
     # Those two are needed for the expected output for test cases,
     # see src/PVE/HA/Sim/Env.pm
     $template_data->{"fence-status"} = $subject;
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pve-devel] [PATCH ha-manager 2/5] build: install PVE::HA::Rules::* in simulator as well
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env Fabian Grünbichler
@ 2025-09-22 12:04 ` Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional Fabian Grünbichler
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/PVE/HA/Makefile       | 1 +
 src/PVE/HA/Rules/Makefile | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Makefile b/src/PVE/HA/Makefile
index 8862907..f3f09a8 100644
--- a/src/PVE/HA/Makefile
+++ b/src/PVE/HA/Makefile
@@ -17,3 +17,4 @@ installsim:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA
 	for i in ${SIM_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/$$i; done
 	make -C Sim install
+	make -C Rules installsim
diff --git a/src/PVE/HA/Rules/Makefile b/src/PVE/HA/Rules/Makefile
index 6411925..1cbde5b 100644
--- a/src/PVE/HA/Rules/Makefile
+++ b/src/PVE/HA/Rules/Makefile
@@ -1,6 +1,12 @@
-SOURCES=NodeAffinity.pm ResourceAffinity.pm
+SIM_SOURCES=NodeAffinity.pm ResourceAffinity.pm
+SOURCES=${SIM_SOURCES}
 
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Rules
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Rules/$$i; done
+
+.PHONY: installsim
+installsim:
+	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Rules
+	for i in ${SIM_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Rules/$$i; done
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 2/5] build: install PVE::HA::Rules::* in simulator as well Fabian Grünbichler
@ 2025-09-22 12:04 ` Fabian Grünbichler
  2025-09-23  9:23   ` Daniel Kral
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 4/5] build: install PVE::HA::Usage::Basic in simulator as well Fabian Grünbichler
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

it's not available in the simulator

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/PVE/HA/Manager.pm | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index ba59f64..cfd509a 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -14,7 +14,12 @@ use PVE::HA::Rules::NodeAffinity qw(get_node_affinity);
 use PVE::HA::Rules::ResourceAffinity
     qw(get_affinitive_resources get_resource_affinity apply_positive_resource_affinity apply_negative_resource_affinity);
 use PVE::HA::Usage::Basic;
-use PVE::HA::Usage::Static;
+
+my $have_static_scheduling;
+eval {
+    require PVE::HA::Usage::Static;
+    $have_static_scheduling = 1;
+};
 
 ## Variable Name & Abbreviations Convention
 #
@@ -244,11 +249,15 @@ sub recompute_online_node_usage {
 
     if (my $mode = $self->{crs}->{scheduler}) {
         if ($mode eq 'static') {
-            $online_node_usage = eval {
-                my $scheduler = PVE::HA::Usage::Static->new($haenv);
-                $scheduler->add_node($_) for $online_nodes->@*;
-                return $scheduler;
-            };
+            if ($have_static_scheduling) {
+                $online_node_usage = eval {
+                    my $scheduler = PVE::HA::Usage::Static->new($haenv);
+                    $scheduler->add_node($_) for $online_nodes->@*;
+                    return $scheduler;
+                };
+            } else {
+                $@ = "static scheduling not available\n";
+            }
             $haenv->log(
                 'warning',
                 "fallback to 'basic' scheduler mode, init for 'static' failed - $@",
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pve-devel] [PATCH ha-manager 4/5] build: install PVE::HA::Usage::Basic in simulator as well
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
                   ` (2 preceding siblings ...)
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional Fabian Grünbichler
@ 2025-09-22 12:04 ` Fabian Grünbichler
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 5/5] sim: add Cluster.pm stub with completion stub Fabian Grünbichler
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

only install Basic module, as the Static one has additional dependencies

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/PVE/HA/Makefile       | 1 +
 src/PVE/HA/Usage/Makefile | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Makefile b/src/PVE/HA/Makefile
index f3f09a8..0b240e1 100644
--- a/src/PVE/HA/Makefile
+++ b/src/PVE/HA/Makefile
@@ -18,3 +18,4 @@ installsim:
 	for i in ${SIM_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/$$i; done
 	make -C Sim install
 	make -C Rules installsim
+	make -C Usage installsim
diff --git a/src/PVE/HA/Usage/Makefile b/src/PVE/HA/Usage/Makefile
index 5a51359..befdda6 100644
--- a/src/PVE/HA/Usage/Makefile
+++ b/src/PVE/HA/Usage/Makefile
@@ -1,6 +1,12 @@
-SOURCES=Basic.pm Static.pm
+SIM_SOURCES=Basic.pm
+SOURCES=${SIM_SOURCES} Static.pm
 
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Usage
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Usage/$$i; done
+
+.PHONY: installsim
+installsim:
+	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Usage
+	for i in ${SIM_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Usage/$$i; done
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pve-devel] [PATCH ha-manager 5/5] sim: add Cluster.pm stub with completion stub
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
                   ` (3 preceding siblings ...)
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 4/5] build: install PVE::HA::Usage::Basic in simulator as well Fabian Grünbichler
@ 2025-09-22 12:04 ` Fabian Grünbichler
  2025-09-23  9:34 ` [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Daniel Kral
  2025-09-23 11:04 ` Daniel Kral
  6 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-22 12:04 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
the same applies here - instead of the stub, we could also conditionally
require PVE::Cluster in NodeAffinity.pm ..

 src/PVE/HA/Sim/Cluster.pm | 11 +++++++++++
 src/PVE/HA/Sim/Makefile   |  2 ++
 2 files changed, 13 insertions(+)
 create mode 100644 src/PVE/HA/Sim/Cluster.pm

diff --git a/src/PVE/HA/Sim/Cluster.pm b/src/PVE/HA/Sim/Cluster.pm
new file mode 100644
index 0000000..a59be04
--- /dev/null
+++ b/src/PVE/HA/Sim/Cluster.pm
@@ -0,0 +1,11 @@
+package PVE::Cluster;
+
+use strict;
+use warnings;
+
+# used as completion helper by PVE::HA::Rules::NodeAffinity
+sub get_nodelist {
+    return;
+}
+
+1;
diff --git a/src/PVE/HA/Sim/Makefile b/src/PVE/HA/Sim/Makefile
index cb8feff..cd889db 100644
--- a/src/PVE/HA/Sim/Makefile
+++ b/src/PVE/HA/Sim/Makefile
@@ -1,7 +1,9 @@
 SOURCES=Env.pm Hardware.pm TestEnv.pm TestHardware.pm RTEnv.pm RTHardware.pm Resources.pm
+STUBS=Cluster.pm
 
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Sim
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Sim/$$i; done
+	for i in ${STUBS}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/$$i; done
 	make -C Resources install
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional Fabian Grünbichler
@ 2025-09-23  9:23   ` Daniel Kral
  2025-09-23 12:21     ` Fabian Grünbichler
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Kral @ 2025-09-23  9:23 UTC (permalink / raw)
  To: Proxmox VE development discussion; +Cc: pve-devel

On Mon Sep 22, 2025 at 2:04 PM CEST, Fabian Grünbichler wrote:
> it's not available in the simulator
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  src/PVE/HA/Manager.pm | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
> index ba59f64..cfd509a 100644
> --- a/src/PVE/HA/Manager.pm
> +++ b/src/PVE/HA/Manager.pm
> @@ -14,7 +14,12 @@ use PVE::HA::Rules::NodeAffinity qw(get_node_affinity);
>  use PVE::HA::Rules::ResourceAffinity
>      qw(get_affinitive_resources get_resource_affinity apply_positive_resource_affinity apply_negative_resource_affinity);
>  use PVE::HA::Usage::Basic;
> -use PVE::HA::Usage::Static;
> +
> +my $have_static_scheduling;
> +eval {
> +    require PVE::HA::Usage::Static;
> +    $have_static_scheduling = 1;
> +};
>  
>  ## Variable Name & Abbreviations Convention
>  #
> @@ -244,11 +249,15 @@ sub recompute_online_node_usage {
>  
>      if (my $mode = $self->{crs}->{scheduler}) {
>          if ($mode eq 'static') {
> -            $online_node_usage = eval {
> -                my $scheduler = PVE::HA::Usage::Static->new($haenv);
> -                $scheduler->add_node($_) for $online_nodes->@*;
> -                return $scheduler;
> -            };
> +            if ($have_static_scheduling) {
> +                $online_node_usage = eval {
> +                    my $scheduler = PVE::HA::Usage::Static->new($haenv);
> +                    $scheduler->add_node($_) for $online_nodes->@*;
> +                    return $scheduler;
> +                };
> +            } else {
> +                $@ = "static scheduling not available\n";
> +            }

Since this cropped up almost 3 years after the static load scheduler was
added and the GTK-based ha-simulator might be on its way out already
[0], I think it would be nice to add a stub for
PVE::HA::Usage::Static here the same way as you did for PVE::Cluster as
otherwise it clutters the main code for the rather rarely used
standalone ha-simulator.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6743

>              $haenv->log(
>                  'warning',
>                  "fallback to 'basic' scheduler mode, init for 'static' failed - $@",



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pve-devel] [RFC ha-manager 0/5] make simulator standalone again
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
                   ` (4 preceding siblings ...)
  2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 5/5] sim: add Cluster.pm stub with completion stub Fabian Grünbichler
@ 2025-09-23  9:34 ` Daniel Kral
  2025-09-23 10:42   ` Thomas Lamprecht
  2025-09-23 11:04 ` Daniel Kral
  6 siblings, 1 reply; 11+ messages in thread
From: Daniel Kral @ 2025-09-23  9:34 UTC (permalink / raw)
  To: Proxmox VE development discussion; +Cc: pve-devel

On Mon Sep 22, 2025 at 2:04 PM CEST, Fabian Grünbichler wrote:
> by moving PVE::Notify to the actual site where it is used, and adapting
> the build parts to install PVE::HA::Usage::Basic and PVE::HA::Rules::*
> in the simulator as well.
>
> CRS is not supported for now, as that would require pulling in a lot
> more parts of PVE into the dependency tree of the simulator..

Thanks, looks good to me!

I tested it in a Debian VM as a standalone package and it works as
expected again. As noted, the ha-simulator seems rather unused (at least
as a standalone package), but good that there weren't too many changes
needed to fix it again.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pve-devel] [RFC ha-manager 0/5] make simulator standalone again
  2025-09-23  9:34 ` [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Daniel Kral
@ 2025-09-23 10:42   ` Thomas Lamprecht
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2025-09-23 10:42 UTC (permalink / raw)
  To: Proxmox VE development discussion, Daniel Kral; +Cc: pve-devel

Am 23.09.25 um 11:34 schrieb Daniel Kral:
> On Mon Sep 22, 2025 at 2:04 PM CEST, Fabian Grünbichler wrote:
>> by moving PVE::Notify to the actual site where it is used, and adapting
>> the build parts to install PVE::HA::Usage::Basic and PVE::HA::Rules::*
>> in the simulator as well.
>>
>> CRS is not supported for now, as that would require pulling in a lot
>> more parts of PVE into the dependency tree of the simulator..
> 
> Thanks, looks good to me!
> 
> I tested it in a Debian VM as a standalone package and it works as
> expected again. As noted, the ha-simulator seems rather unused (at least
> as a standalone package), but good that there weren't too many changes
> needed to fix it again.

Can I get a T-b then? As b4 would pick that up automatically on
applying.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pve-devel] [RFC ha-manager 0/5] make simulator standalone again
  2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
                   ` (5 preceding siblings ...)
  2025-09-23  9:34 ` [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Daniel Kral
@ 2025-09-23 11:04 ` Daniel Kral
  6 siblings, 0 replies; 11+ messages in thread
From: Daniel Kral @ 2025-09-23 11:04 UTC (permalink / raw)
  To: Proxmox VE development discussion; +Cc: pve-devel

Forgot the T-b here, thanks @Thomas!

Tested-by: Daniel Kral <d.kral@proxmox.com>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional
  2025-09-23  9:23   ` Daniel Kral
@ 2025-09-23 12:21     ` Fabian Grünbichler
  0 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2025-09-23 12:21 UTC (permalink / raw)
  To: Proxmox VE development discussion

Quoting Daniel Kral (2025-09-23 11:23:42)
> On Mon Sep 22, 2025 at 2:04 PM CEST, Fabian Grünbichler wrote:
> > it's not available in the simulator
> >
> > Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> > ---
> >  src/PVE/HA/Manager.pm | 21 +++++++++++++++------
> >  1 file changed, 15 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
> > index ba59f64..cfd509a 100644
> > --- a/src/PVE/HA/Manager.pm
> > +++ b/src/PVE/HA/Manager.pm
> > @@ -14,7 +14,12 @@ use PVE::HA::Rules::NodeAffinity qw(get_node_affinity);
> >  use PVE::HA::Rules::ResourceAffinity
> >      qw(get_affinitive_resources get_resource_affinity apply_positive_resource_affinity apply_negative_resource_affinity);
> >  use PVE::HA::Usage::Basic;
> > -use PVE::HA::Usage::Static;
> > +
> > +my $have_static_scheduling;
> > +eval {
> > +    require PVE::HA::Usage::Static;
> > +    $have_static_scheduling = 1;
> > +};
> >  
> >  ## Variable Name & Abbreviations Convention
> >  #
> > @@ -244,11 +249,15 @@ sub recompute_online_node_usage {
> >  
> >      if (my $mode = $self->{crs}->{scheduler}) {
> >          if ($mode eq 'static') {
> > -            $online_node_usage = eval {
> > -                my $scheduler = PVE::HA::Usage::Static->new($haenv);
> > -                $scheduler->add_node($_) for $online_nodes->@*;
> > -                return $scheduler;
> > -            };
> > +            if ($have_static_scheduling) {
> > +                $online_node_usage = eval {
> > +                    my $scheduler = PVE::HA::Usage::Static->new($haenv);
> > +                    $scheduler->add_node($_) for $online_nodes->@*;
> > +                    return $scheduler;
> > +                };
> > +            } else {
> > +                $@ = "static scheduling not available\n";
> > +            }
> 
> Since this cropped up almost 3 years after the static load scheduler was
> added and the GTK-based ha-simulator might be on its way out already
> [0], I think it would be nice to add a stub for
> PVE::HA::Usage::Static here the same way as you did for PVE::Cluster as
> otherwise it clutters the main code for the rather rarely used
> standalone ha-simulator.
> 
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=6743

yes, that's definitely doable and should just require a `new()` implementation
that dies, so fairly simple..


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-09-23 12:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 2/5] build: install PVE::HA::Rules::* in simulator as well Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional Fabian Grünbichler
2025-09-23  9:23   ` Daniel Kral
2025-09-23 12:21     ` Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 4/5] build: install PVE::HA::Usage::Basic in simulator as well Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 5/5] sim: add Cluster.pm stub with completion stub Fabian Grünbichler
2025-09-23  9:34 ` [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Daniel Kral
2025-09-23 10:42   ` Thomas Lamprecht
2025-09-23 11:04 ` Daniel Kral

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal