mirror of
git://git.proxmox.com/git/pve-ha-manager.git
synced 2025-01-19 14:03:53 +03:00
manager: online node usage: factor out possible traget and future proof
only count up target selection if that node is already in the online node usage list, to avoid that a offline node is considered online if its a target from any command Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
8c80973d40
commit
6f818da13f
@ -187,6 +187,7 @@ sub recompute_online_node_usage {
|
||||
foreach my $sid (keys %{$self->{ss}}) {
|
||||
my $sd = $self->{ss}->{$sid};
|
||||
my $state = $sd->{state};
|
||||
my $target = $sd->{target}; # optional
|
||||
if (defined($online_node_usage->{$sd->{node}})) {
|
||||
if (
|
||||
$state eq 'started' || $state eq 'request_stop' || $state eq 'fence' ||
|
||||
@ -196,13 +197,13 @@ sub recompute_online_node_usage {
|
||||
} elsif (($state eq 'migrate') || ($state eq 'relocate')) {
|
||||
# count it for both, source and target as load is put on both
|
||||
$online_node_usage->{$sd->{node}}++;
|
||||
$online_node_usage->{$sd->{target}}++;
|
||||
$online_node_usage->{$target}++;
|
||||
} elsif ($state eq 'stopped') {
|
||||
# do nothing
|
||||
} else {
|
||||
die "should not be reached (sid = '$sid', state = '$state')";
|
||||
}
|
||||
} elsif (defined(my $target = $sd->{target})) {
|
||||
} elsif (defined($target) && defined($online_node_usage->{$target})) {
|
||||
if ($state eq 'migrate' || $state eq 'relocate') {
|
||||
# to correctly track maintenance modi and also consider the target as used for the
|
||||
# case a node dies, as we cannot really know if the to-be-aborted incoming migration
|
||||
|
Loading…
x
Reference in New Issue
Block a user