On Thu Aug 21, 2025 at 4:35 PM CEST, Daniel Kral wrote: > Some rule checks depend on the list of cluster nodes, e.g., to check > whether a negative resource affinity rule doesn't specify more HA resources > than cluster nodes. > > The HA Manager retranslate rules only in certain conditions to reduce > unnecessary computations, but lacks a check whether cluster nodes have > been added or removed, which is different from what users are reported > through the rules API endpoints and web interface. > > Fixes: 6c4c0458 ("rules: add haenv node list to the rules' canonicalization > stage") > Signed-off-by: Daniel Kral <d.k...@proxmox.com> > --- > src/PVE/HA/Manager.pm | 2 ++ > src/PVE/HA/NodeStatus.pm | 14 ++++++++++++++ > 2 files changed, 16 insertions(+)
As @Michael and I briefly taked about this off-list, the nodelist shouldn't cange too much in production (i.e. the PVE2 environment), but this check makes the HA rules retranslation more correct as the checks are dependent on $nodes. AFAICT the main reasons the nodelist changes in production is that a node joins or leaves, where PVE::HA::Env::PVE2::get_node_info($self) gets the nodelist from PVE::Cluster::get_members(). Even though the pve-ha-crm systemd unit has an ordering dependency on pve-cluster, pvedaemon, ..., which are restarted on node join, these are only restarted on the newly added node AFAICS when calling PVE::Cluster::Setup::join, so the HA Manager isn't updated with the new nodelist in that case, therefore the added condition in this patch is required. I noticed this when implementing the plugin_compile for the node affinity rules, which heavily depend on the $nodes. Without this additional condition, at least 'test-crs-static2' will fail as it doesn't power on all nodes at once, but only powers node4 some time later. The nodelist won't be updated and therefore the HA node affinity rule in that test cases won't get retranslated too, which will change the behavior of the node (re)assignment. The check helper could definitely been implemented nicer, but I didn't want to overcomplicate things here. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel