xonecas.io
8447
Co

conveyor / commit 3c10db6

Tickets wait as ready while the base image is missing or baking

A ticket started during a rebake failed at once with qemu-img's "Could
not open base.qcow2". Worse, one started while the bake writes the new
image could boot a half-written disk. Dispatch now starts nothing until
base.qcow2 exists and the bake's work file is gone.

Co-Authored-By: Claude Opus 5.5

sacenox2026-11-09 3c10db6851ac32eeae8bec1354c446bd1e1fb9c7 parent 1e898fa

1 file changed

crates/conveyor/src/dispatch.rs+9−2
@@ -1,5 +1,5 @@
11 //! Moves ready tickets onto free slots, one worker thread per running ticket.
2-use crate::{agent, store};
2+use crate::{agent, paths, store};
33 use std::time::Duration;
44
55 const BUSY: [&str; 1] = ["running"];
@@ -12,7 +12,7 @@ pub fn run() -> ! {
1212 }
1313 }
1414 loop {
15- for p in store::projects() {
15+ for p in store::projects().into_iter().filter(|_| image_ready()) {
1616 let tickets = store::tickets(&p.slug);
1717 let busy = tickets.iter().filter(|t| BUSY.contains(&t.state.as_str())).count();
1818 for t in tickets.iter().filter(|t| t.state == "ready").take(p.slots.saturating_sub(busy)) {
@@ -24,3 +24,10 @@ pub fn run() -> ! {
2424 std::thread::sleep(Duration::from_secs(2));
2525 }
2626 }
27+
28+/// The base image is there and not being baked (the bake writes it last, then removes its
29+/// work file). Until then tickets wait as ready.
30+fn image_ready() -> bool {
31+ let base = paths::base_image();
32+ base.exists() && !base.with_extension("baking.qcow2").exists()
33+}