Re: [PATCH ha-manager v4 19/28] implement automatic rebalancing

Dominik Rusovac
2026-04-02T13:14:52Z

lgtm, consider this

On Thu Apr 2, 2026 at 2:44 PM CEST, Daniel Kral wrote:
> If the automatic load balancing system is enabled, it checks whether the
> cluster node imbalance exceeds some user-defined threshold for some HA
> Manager rounds ("hold duration"). If it does exceed on consecutive HA
> Manager rounds, it will choose the best resource motion to improve the
> cluster node imbalance and queue it if it significantly improves it by
> some user-defined imbalance improvement ("margin").
>
> This patch introduces resource bundles, which ensure that HA resources
> in strict positive resource affinity rules are considered as a whole
> "bundle" instead of individual HA resources.
>
> Specifically, active and stationary resource bundles are resource
> bundles, that have at least one resource running and all resources
> located on the same node. This distinction is needed as newly created
> strict positive resource affinity rules may still require some resource
> motions to enforce the rule.
>
> Additionally, the migration candidate generation prunes any target
> nodes, which do not adhere to the HA rules of these resource bundles
> before scoring these migration candidates.
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> changes v3 -> v4:
> - change imbalance threshold default value from 0.7 to 0.3
> - use sprintf() for float number printing instead of perly rounding
> logic
> - print before and expected after values
> - implement PVE::HA::Usage::Basic rebalancing methods as well with
> sensible return values, but which are only used to not throw errors if
> a failback from 'dynamic'/'static' to 'basic' happens in
> recompute_online_node_usage()
>

[snip]