Am 20.01.26 um 10:25 AM schrieb Daniel Kral:
> On Mon Jan 19, 2026 at 4:24 PM CET, Daniel Kral wrote:
>> On Mon Jan 19, 2026 at 4:00 PM CET, Fiona Ebner wrote:
>>> Am 15.12.25 um 4:55 PM schrieb Daniel Kral:
>>>> The logic in execute_migration(...) and get_resource_motion_info(...) to
>>>> gather dependent and blocking HA resources is equivalent and should also
>>>> be the same for consistency, so factor them out as a separate helper.
>>>>
>>>> The PVE::HA::Helpers package is introduced since there does not exist a
>>>> package for shared logic between packages, which cannot depend on each
>>>> other (e.g. Manager and Config, LRM and CRM, etc.) and PVE::HA::Tools is
>>>> not the right place for these.
>>>
>>> It is a rather specific helper and PVE::HA::Helpers sounds very general.
>>> Could we also put it in PVE::HA::Rules::Helpers or somewhere else below
>>> PVE::HA::Rules or is there a good reason not to?
>>
>> Not really, I've thought of PVE::HA::Rules::Helpers as a module for
>> helpers for the rules themselves instead of users of the rules, but it
>> makes sense to share rules-related helpers in a single module, so I'll
>> move it there too.
> 
> Oh wait, just noticed that this would create a circular dependency,
> because get_resource_motion_info(...) uses get_affinitive_resources(...)
> from PVE::HA::Rules::ResourceAffinity, and
> PVE::HA::Rules::ResourceAffinity in turn uses PVE::HA::Rules::Helpers
> again..
> 
> I'd tend to let get_resource_motion_info(...) stay in PVE::HA::Helpers,
> or do you have other ideas?

Okay, so get_resource_motion_info() depends on:
PVE::HA::Rules::NodeAffinity
PVE::HA::Rules::ResourceAffinity

And in fact, having a PVE::HA::Helpers depend on those two seems bad for
moving forward, because it means that those two modules won't be able to
use PVE::HA::Helpers without creating a circular dependency. Ideally,
the PVE::HA::Helpers module would not have such dependencies and be
usable from essentially any other HA module.

So considering the two dependencies, what about putting
get_resource_motion_info() in PVE::HA::Rules itself? It is a more
top-level function that depends on the rule submodules, so that seems to
be a fitting place.


_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to