all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH ha-manager 0/2] fix param check for rules updates and
@ 2026-03-24 12:49 Michael Köppl
  2026-03-24 12:49 ` [PATCH ha-manager 1/2] api: assert validity of resources param only if defined Michael Köppl
  2026-03-24 12:49 ` [PATCH ha-manager 2/2] format code with perltidy Michael Köppl
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Köppl @ 2026-03-24 12:49 UTC (permalink / raw)
  To: pve-devel

This series fixes the PUT API endpoint for updating a HA rule.
Previously, it would fail if the resources parameter was not set at all
as part of the request, even though the param is optional As part of an
E2E test run, the error showed up as

    500 update HA rules failed: Can't use an undefined value as a HASH
    reference at /usr/share/perl5/PVE/API2/HA/Rules.pm line 48.

In addition, 2/2 fixes wrong formatting introduced by a recent commit.

pve-ha-manager:

Michael Köppl (2):
  api: assert validity of resources param only if defined
  format code with perltidy

 src/PVE/API2/HA/Rules.pm   | 2 +-
 src/PVE/HA/Usage/Static.pm | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)


Summary over all repositories:
  2 files changed, 5 insertions(+), 3 deletions(-)

-- 
Generated by murpp 0.11.0




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

* [PATCH ha-manager 1/2] api: assert validity of resources param only if defined
  2026-03-24 12:49 [PATCH ha-manager 0/2] fix param check for rules updates and Michael Köppl
@ 2026-03-24 12:49 ` Michael Köppl
  2026-03-24 12:49 ` [PATCH ha-manager 2/2] format code with perltidy Michael Köppl
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Köppl @ 2026-03-24 12:49 UTC (permalink / raw)
  To: pve-devel

The check for the validity of the resources param should only be
performed if the param was even defined, since it is not a required
parameter for updating a rule. Previously, when not setting the
resources field as part of the request, the check in the assert
function would fail due to using undefined as a hash reference, which
would stop users from updating a rule.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 src/PVE/API2/HA/Rules.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/API2/HA/Rules.pm b/src/PVE/API2/HA/Rules.pm
index f09ab36..0b44d51 100644
--- a/src/PVE/API2/HA/Rules.pm
+++ b/src/PVE/API2/HA/Rules.pm
@@ -343,7 +343,7 @@ __PACKAGE__->register_method({
                 my $plugin = PVE::HA::Rules->lookup($type);
                 my $opts = $plugin->check_config($ruleid, $param, 0, 1);
 
-                $assert_valid_resources_param->($opts->{resources});
+                $assert_valid_resources_param->($opts->{resources}) if $opts->{resources};
                 $assert_valid_nodes_param->($opts->{nodes}) if $opts->{nodes};
 
                 my $options = $plugin->private()->{options}->{$type};
-- 
2.47.3





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

* [PATCH ha-manager 2/2] format code with perltidy
  2026-03-24 12:49 [PATCH ha-manager 0/2] fix param check for rules updates and Michael Köppl
  2026-03-24 12:49 ` [PATCH ha-manager 1/2] api: assert validity of resources param only if defined Michael Köppl
@ 2026-03-24 12:49 ` Michael Köppl
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Köppl @ 2026-03-24 12:49 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 src/PVE/HA/Usage/Static.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/Usage/Static.pm b/src/PVE/HA/Usage/Static.pm
index 6ff2079..b60f500 100644
--- a/src/PVE/HA/Usage/Static.pm
+++ b/src/PVE/HA/Usage/Static.pm
@@ -33,8 +33,10 @@ sub add_node {
 
     my $stats = $self->{'node-stats'}->{$nodename}
         or die "did not get static node usage information for '$nodename'\n";
-    die "static node usage information for '$nodename' missing cpu count\n" if !defined($stats->{maxcpu});
-    die "static node usage information for '$nodename' missing memory\n" if !defined($stats->{maxmem});
+    die "static node usage information for '$nodename' missing cpu count\n"
+        if !defined($stats->{maxcpu});
+    die "static node usage information for '$nodename' missing memory\n"
+        if !defined($stats->{maxmem});
 
     eval { $self->{scheduler}->add_node($nodename, int($stats->{maxcpu}), int($stats->{maxmem})); };
     die "initializing static node usage for '$nodename' failed - $@" if $@;
-- 
2.47.3





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

end of thread, other threads:[~2026-03-24 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-24 12:49 [PATCH ha-manager 0/2] fix param check for rules updates and Michael Köppl
2026-03-24 12:49 ` [PATCH ha-manager 1/2] api: assert validity of resources param only if defined Michael Köppl
2026-03-24 12:49 ` [PATCH ha-manager 2/2] format code with perltidy Michael Köppl

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