Re: [PATCH ha-manager v3 30/40] usage: use add_service to add service usage to nodes

Dominik Rusovac
2026-03-31T08:12:20Z

lgtm, consider this

On Mon Mar 30, 2026 at 4:30 PM CEST, Daniel Kral wrote:
> The pve_static (and upcoming pve_dynamic) bindings expose the new
> add_resource(...) method, which allow adding resources in a single call
> with the additional running flag.
>
> The running flag is needed to discriminate starting and started HA
> resources from each other, which is needed to correctly account for HA
> resources for the dynamic load usage implementation in the next patch.
>
> This is because for the dynamic load usage, any HA resource, which is
> scheduled to start by the HA Manager in the same round, will not be
> accounted for in the next call to score_nodes_to_start_resource(...).
> This is not a problem for the static load usage, because there the
> current node usages are derived from the started resources on every
> call already.
>
> Passing only the HA resources' 'state' property is not enough since the
> HA Manager will move any HA resource from the 'request_start' (or
> through other transient states such as 'request_start_balance' and a
> successful 'migrate'/'relocate') into the 'started' state.
>
> This 'started' state is then picked up by the HA resource's LRM, which
> will actually start the HA resource and if successful respond with a
> 'SUCCESS' LRM result. Only then will the HA Manager acknowledges this by
> adding the running flag to the HA resource's state.
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> changes v2 -> v3:
> - fix setting $running flag only if state 'started' and running is set
> or for any non-started state where current_node is set
> - Additionally handle the case where only $target_node is set in
> add_service(), which can only happen in specific cases; I have some
> patches which inline this behavior in get_used_service_nodes() (should
> be named something else later) to make this behavior more consise, but
> that should be handled separately
> - change the $service property names to kebab-case
>

[snip]