2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-03 16:06:59 +00:00

fix(dhcp): report unresolved Kea reservations

(cherry picked from commit 90c6eeae55)
This commit is contained in:
Vinícius Ferrão
2026-07-31 15:12:41 -03:00
committed by github-actions[bot]
parent 9f45309138
commit d1d178943b
+9 -2
View File
@@ -2476,6 +2476,11 @@ sub kea_process_request
$client_classes_changed = kea_remove_xnba_client_classes($loaded4, $nodes);
} else {
$reservations4 = kea_build_node_reservations($backend, $loaded4, $nodes);
if (ref($reservations4) eq 'HASH' && $reservations4->{error}) {
$callback->({ error => [ $reservations4->{error} ], errorcode => [1] });
flock($dhcplockfd, LOCK_UN);
return;
}
$backend->upsert_reservations($loaded4, $reservations4);
$client_classes_changed = kea_sync_xnba_client_classes($loaded4, $nodes);
if ($loaded6) {
@@ -3092,7 +3097,9 @@ sub kea_build_node_reservations
my @reservations;
foreach my $node (@$nodes) {
push @reservations, @{ kea_node_reservations($backend, $config, $node) };
my $node_reservations = kea_node_reservations($backend, $config, $node);
return $node_reservations if ref($node_reservations) eq 'HASH' && $node_reservations->{error};
push @reservations, @$node_reservations;
}
return \@reservations;
@@ -3148,7 +3155,7 @@ sub kea_node_reservations
$mac = $normalized_mac;
my $ip = getipaddr($hname, OnlyV4 => 1);
next unless $ip;
return { error => "Unable to resolve $hname for the Kea DHCP reservation for $node." } unless $ip;
if (ipIsDynamic($ip)) {
$callback->({ error => ["Node $node has IP $ip which is inside the DHCP dynamic range. Move the node IP outside the dynamic range or adjust the range in the networks table."], errorcode => [1] });