Otherwise HA resources that are in positive resource affinity rules with
ignored HA resources will be shown as dependent resources for callers of
get_resource_motion_info(...), even though the ignored HA resource(s)
won't be affected.

These are already ignored in the HA Manager for the migrate command
since 1c9c35d4 ("config, manager: do not check ignored resources with
affinity when migrating").

Fixes: 47340b13 ("api: resources: add check for resource affinity in resource 
migrations")
Signed-off-by: Daniel Kral <d.k...@proxmox.com>
---
 src/PVE/HA/Config.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
index 301c62fe..b2ef26aa 100644
--- a/src/PVE/HA/Config.pm
+++ b/src/PVE/HA/Config.pm
@@ -394,7 +394,12 @@ sub get_resource_motion_info {
         my $rules = read_and_check_effective_rules_config();
         my ($together, $separate) = get_affinitive_resources($rules, $sid);
 
-        push @$dependent_resources, $_ for sort keys %$together;
+        for my $csid (sort keys %$together) {
+            next if !defined($ss->{$csid});
+            next if $ss->{$csid}->{state} eq 'ignored';
+
+            push @$dependent_resources, $csid;
+        }
 
         for my $node (keys %$ns) {
             next if $ns->{$node} ne 'online';
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to