Skip to content

Commit 9f1a4ea

Browse files
committed
Fix find_resource_slot live mode: extract host from label_allocations
The host (instance_parent) for reservations was only checked in sliver.get_labels(), which stores request labels and typically does not contain the allocated host. The actual host assignment lives in sliver.get_label_allocations(). This caused all reservations to have host=None, silently skipping resource subtraction and making reserved resources appear available. Now checks label_allocations first, falling back to labels. Also adds warning logging when host is None and debug logging for each reservations extracted data.
1 parent a885ed1 commit 9f1a4ea

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

fabric_cf/orchestrator/core/orchestrator_handler.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,8 +1388,18 @@ def _find_slot_live(self, *, body: dict, token: str) -> dict:
13881388
r_start = ActorClock.from_milliseconds(milli_seconds=r.get_start())
13891389
r_end = ActorClock.from_milliseconds(milli_seconds=r.get_end())
13901390
host = None
1391-
if sliver.get_labels() and sliver.get_labels().instance_parent:
1392-
host = sliver.get_labels().instance_parent
1391+
label_allocs = sliver.get_label_allocations()
1392+
labels = sliver.get_labels()
1393+
if label_allocs and getattr(label_allocs, 'instance_parent', None):
1394+
host = label_allocs.instance_parent
1395+
elif labels and getattr(labels, 'instance_parent', None):
1396+
host = labels.instance_parent
1397+
if host is None:
1398+
self.logger.warning(
1399+
f"find_resource_slot: reservation {r.get_reservation_id()} "
1400+
f"has no instance_parent in labels or label_allocations; "
1401+
f"its resources will not be subtracted from host capacity"
1402+
)
13931403
alloc = sliver.capacity_allocations
13941404
caps = sliver.capacities
13951405
cores = (getattr(alloc, 'core', 0) or 0) if alloc else 0
@@ -1398,14 +1408,20 @@ def _find_slot_live(self, *, body: dict, token: str) -> dict:
13981408
ram = ram or ((getattr(caps, 'ram', 0) or 0) if caps else 0)
13991409
disk = (getattr(alloc, 'disk', 0) or 0) if alloc else 0
14001410
disk = disk or ((getattr(caps, 'disk', 0) or 0) if caps else 0)
1411+
comps = self._extract_reservation_components(sliver)
1412+
self.logger.debug(
1413+
f"find_resource_slot: reservation {r.get_reservation_id()} "
1414+
f"host={host} cores={cores} ram={ram} disk={disk} "
1415+
f"components={comps} lease=[{r_start}, {r_end}]"
1416+
)
14011417
compute_reservations.append({
14021418
"host": host,
14031419
"lease_start": r_start,
14041420
"lease_end": r_end,
14051421
"cores": cores,
14061422
"ram": ram,
14071423
"disk": disk,
1408-
"components": self._extract_reservation_components(sliver),
1424+
"components": comps,
14091425
})
14101426

14111427
# Query network service reservations (for links and/or facility ports)

0 commit comments

Comments
 (0)