Disable / Enable ha-manager resource-affinity rules via CLI not working anymore (after upgrading to 9.1.9)

lumix1991

Member
Jan 9, 2024
9
2
8
Hi There,

We use Ansible to upgrade our proxmox clusters, during the upgrades we temporarely disable any active HA-rules to prevent unexpected migrations during upgrades.

We use the "ha-manager rules set" commands for this.

Since we upgraded one of our nodes to 9.1.9 (from 9.1.5) we receive the following errors when disabling/enabling the HA rules.

Disable:
Code:
root@node01:~# ha-manager rules set resource-affinity ha-rule-d18b3c88-2fba --disable 1
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.

Enable:
Code:
root@node01:~# ha-manager rules set resource-affinity ha-rule-d18b3c88-2fba --delete disable
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.

Version:
Code:
root@node01:~# pveversion
pve-manager/9.1.9/ee7bad0a3d1546c9 (running kernel: 6.17.13-6-pve)

Via the web UI this still works properly.

On 9.1.5 nodes it still works:

Code:
root@compute01:~# pveversion
pve-manager/9.1.5/80cf92a64bef6889 (running kernel: 6.17.4-2-pve)

root@compute01:~# ha-manager rules set resource-affinity ha-rule-fc025361-6de0 --disable 1

root@compute01:~# ha-manager rules set resource-affinity ha-rule-fc025361-6de0 --delete disable
 
Last edited:
Hi!

Unfortunately, this is a bug, which was introduced in pve-ha-manager 5.1.2, but is fixed for the current pve-ha-manager 5.2.0, which is on the pve-test and pve-no-subscription repositories.

If you currently cannot update to this package version, it should work to add the resources option with the current value:

Code:
ha-manager rules set resource-affinity ha-rule-d18b3c88-2fba --disable 1 --resources <current-resources-list>

Similarly, though not recommended, one can also manually edit the /etc/pve/ha/rules.cfg file and add disable to the HA rules that should be disabled, for example:

Rich (BB code):
resource-affinity: ha-rule-d18b3c88-2fba
    disable
    resources ...
    affinity ...