Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ and listed with their assets on the
services, its start) showed as "by an unknown client" in that lane's
*Activity*; it now shows as "by devstack". The client a person used is
in the requester's journal.
- **A node that cannot take a lane says what other starts hold there.**
For a minute after it is offered, a lease for another lane holds its
room on its node; the node's figures in the dashboard do not count it,
so a node with enough free read "cannot take it: offers 3.9 CPU …". The
reason now adds "4.8 CPU and 1802 MiB more are held for a lane starting
there".
- **A lane on a node keeps its journal** (#287): the requester's take of
the lane daemon's telemetry lines, every 30 seconds, went into that
daemon's journal as "take the telemetry lines by an unknown client" and
Expand Down
30 changes: 30 additions & 0 deletions crates/devstack-node/src/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1723,10 +1723,31 @@ fn placement_for(
);
for p in &mut out {
p.need_from = Some(from.clone());
// What offers for other lanes hold there is not in the node's own
// figures the dashboard shows: say so where it decides.
if !p.eligible && (p.cpus < need.cpus || p.memory < need.memory) {
let held = held_by(&leases, &p.node, |l, at| {
l.state == "offered" && at.elapsed() < OFFER_HOLDS && !(own && mine(l))
});
p.why = with_held(&p.why, held);
}
}
out
}

/// A refusal for want of CPU or memory, with what offers for other lanes
/// hold of the node's offer, if they hold any.
fn with_held(why: &str, held: Held) -> String {
if held.cpus <= 0.0 && held.memory == 0 {
return why.to_string();
}
format!(
"{why}; {:.1} CPU and {} MiB more are held for a lane starting there",
held.cpus,
held.memory >> 20
)
}

/// `GET /v1/placement?repo=&lane=&cpus=&memory=&disk=&profile=`: where a
/// lane of the caller's would go, best first, with why (what the dashboard
/// shows beside the nodes to start it on). `disk` is the requester's
Expand Down Expand Up @@ -3741,6 +3762,15 @@ mod placement_tests {
},
);
assert!(!o[0].1, "{o:?}");
// The refusal says what they hold; with nothing held, it is as it was.
assert_eq!(
with_held("offers 2.0 CPU", held),
"offers 2.0 CPU; 2.0 CPU and 6144 MiB more are held for a lane starting there"
);
assert_eq!(
with_held("offers 2.0 CPU", Held::default()),
"offers 2.0 CPU"
);
// Their disk is held too.
assert_eq!(held.disk, 6 * GIB);
assert_eq!(rep.disk_room, Some(94 * GIB));
Expand Down