mirror of
https://git.proxmox.com/git/pve-ha-manager
synced 2025-04-28 13:55:09 +00:00
crs: avoid auto-vivification when adding node to service usage
Part of what caused bug #4984. Make the code future-proof and warn when the node was never registered in the plugin, similar to what the 'static' usage plugin already does. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> [ TL: rework commit message subject ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c7843a315d
commit
1c61138341
@ -10,6 +10,7 @@ sub new {
|
||||
|
||||
return bless {
|
||||
nodes => {},
|
||||
haenv => $haenv,
|
||||
}, $class;
|
||||
}
|
||||
|
||||
@ -40,7 +41,14 @@ sub contains_node {
|
||||
sub add_service_usage_to_node {
|
||||
my ($self, $nodename, $sid, $service_node, $migration_target) = @_;
|
||||
|
||||
$self->{nodes}->{$nodename}++;
|
||||
if ($self->contains_node($nodename)) {
|
||||
$self->{nodes}->{$nodename}++;
|
||||
} else {
|
||||
$self->{haenv}->log(
|
||||
'warning',
|
||||
"unable to add service '$sid' usage to node '$nodename' - node not in usage hash",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub score_nodes_to_start_service {
|
||||
|
Loading…
Reference in New Issue
Block a user