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>
return bless {
nodes => {},
+ haenv => $haenv,
}, $class;
}
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 {