[pve-devel] [PATCH FOLLOW-UP ha-manager v2 4/4] ha: check for actual disable value during rule checks

Fiona Ebner f.ebner at proxmox.com
Wed Sep 17 14:34:43 CEST 2025


Am I correct in that ha-manager patches 1/4, 2/4 and 3/4 have been
superseded/obsoleted?

Am 23.07.25 um 5:35 PM schrieb Michael Köppl:
> When exclude_disabled_rules was enabled, rules would be excluded from
> the check even if the value was actually false, since it still existed.
> The check now makes sure that the rule is really disabled before
> excluding it.
> 
> Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>

Needs to be rebased for current master.

> ---
>  src/PVE/HA/Rules.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/HA/Rules.pm b/src/PVE/HA/Rules.pm
> index bda0b5d..e756c7d 100644
> --- a/src/PVE/HA/Rules.pm
> +++ b/src/PVE/HA/Rules.pm
> @@ -431,7 +431,7 @@ sub foreach_rule : prototype($$;$) {
>          next if !$rule; # skip invalid rules
>          next if defined($sid) && !defined($rule->{resources}->{$sid});
>          next if defined($type) && $rule->{type} ne $type;
> -        next if $exclude_disabled_rules && exists($rule->{disable});
> +        next if $exclude_disabled_rules && exists($rule->{disable}) && $rule->{disable};

Please drop the exists check, that makes it harder to read and we don't
usually do that when checking if a boolean property is true.

>  
>          $func->($rule, $ruleid);
>      }


I noticed that this doesn't fix setting disabled to false via API, i.e.

[I] root at pve9a1 ~# pvesh set /cluster/ha/rules/ha-rule-foo --disable 0
--type resource-affinity
[I] root at pve9a1 ~# pvesh get /cluster/ha/rules/ha-rule-foo
--output-format json-pretty | grep disable
   "disable" : 1,

Could you take a look at that too?




More information about the pve-devel mailing list