Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a0e4710
ci: boot Firecracker microVMs on GitHub's x86_64 runners
fctl-sh[bot] Nov 6, 2026
976785e
ci: quote the firecracker job's test filter, which YAML read as a map…
fctl-sh[bot] Nov 6, 2026
616cd0f
fix(host): start passt without --hostname, which Ubuntu 24.04's passt…
fctl-sh[bot] Nov 6, 2026
fbf92f5
test(host): say what passt and the VM's network say when a sandbox ha…
fctl-sh[bot] Nov 6, 2026
8f88b35
fix(host): give Firecracker VMs DNS past systemd-resolved's stub, as …
fctl-sh[bot] Nov 6, 2026
e88ee76
fix(host): leave link-local DNS servers out of passt's, which it can'…
fctl-sh[bot] Nov 6, 2026
681768b
fix(host): give Firecracker VMs the host's nameservers, past systemd-…
fctl-sh[bot] Nov 6, 2026
5d45e3a
test(host): say what passt, the VM's console and AppArmor say when a …
fctl-sh[bot] Nov 6, 2026
c0f2383
test(host): capture passt's frames and debug log in CI, where VMs get…
fctl-sh[bot] Nov 6, 2026
b78389c
test(host): say where passt waits, as root, when a sandbox has no net…
fctl-sh[bot] Nov 6, 2026
e384059
test(host): passt's trace in CI, which logs each event
fctl-sh[bot] Nov 6, 2026
554c8ff
test(host): trace passt's accept in CI
fctl-sh[bot] Nov 6, 2026
c93b5a8
fix(host): link a Firecracker VM's network from the host, which Ubunt…
fctl-sh[bot] Nov 6, 2026
6076b12
fix(host): count passt as linked once it writes its pid, not once it …
fctl-sh[bot] Nov 6, 2026
79f0688
feat(host): resume stopped Firecracker sandboxes where they were
fctl-sh[bot] Nov 6, 2026
9165e14
test(host): a stopped Firecracker sandbox resumes with its programs r…
fctl-sh[bot] Nov 6, 2026
63e078f
fix(host): remove a sandbox that goes without stopping it first
fctl-sh[bot] Nov 6, 2026
3babf1e
fix(host): write passt's pid where it can as root, and boot a sandbox…
fctl-sh[bot] Nov 6, 2026
e64ae96
fix(host): resume only VMs of the size asked, save one at a time, and…
fctl-sh[bot] Nov 6, 2026
53e91cd
ci: find the test binary to run as root without cargo's colours, and …
fctl-sh[bot] Nov 6, 2026
6e8496c
fix(host): count the disk measured after letting saved states go when…
fctl-sh[bot] Nov 6, 2026
9080e50
fix(host): write passt's pid in /tmp as root, under a name no one can…
fctl-sh[bot] Nov 6, 2026
0ad0dd0
test(host): check that a failed link removes the pid's file passt was…
fctl-sh[bot] Nov 6, 2026
27043ba
Merge remote-tracking branch 'origin/fctl/802-firecracker-hosts-packa…
fctl-sh[bot] Nov 6, 2026
76a6730
Merge origin/main into fctl/802-firecracker-snapshots, and save no st…
fctl-sh[bot] Nov 6, 2026
851df4e
Merge origin/main into fctl/802-firecracker-snapshots, and save no st…
fctl-sh[bot] Nov 6, 2026
a177c5b
fix(host): resume no saved state, and keep none, on a host that turns…
fctl-sh[bot] Nov 6, 2026
6fac9b2
docs(host): say in host.toml's docs that turning snapshots off lets k…
fctl-sh[bot] Nov 6, 2026
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
7 changes: 7 additions & 0 deletions crates/fctl-host/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
//! kernel = "/var/lib/fctl/vmlinux" # a file, or an image with /vmlinux (unset: the published one)
//! disk_gb = 64 # each sandbox's own disk, which takes only what it holds
//! jailer = true # as root: each VM as a user of its own, in a chroot and a cgroup
//! snapshots = true # a stopped sandbox keeps its VM's memory, and resumes as it was
//! ```
//!
//! The runner token lives next to it in `host-token`, and the Claude token
Expand Down Expand Up @@ -162,6 +163,11 @@ pub struct FirecrackerConfig {
/// jailer: as a user of its own, in a chroot with only its files, and
/// in a cgroup of its own. A host that doesn't run as root can't.
pub jailer: bool,
/// Whether stopping a sandbox saves its VM's state, its memory with the
/// programs in it, so that it resumes where it was rather than boot
/// again: it takes as much disk as the memory the VM uses, until the
/// sandbox starts again, goes, or the disk runs low.
pub snapshots: bool,
}

impl Default for FirecrackerConfig {
Expand All @@ -172,6 +178,7 @@ impl Default for FirecrackerConfig {
passt: None,
disk_gb: 64,
jailer: true,
snapshots: true,
}
}
}
Expand Down
53 changes: 46 additions & 7 deletions crates/fctl-host/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ enum CacheDone {
/// What background work on sandboxes that no session runs in reports.
enum Chore {
/// The sweep listed this host's sandboxes, and the projects whose
/// package caches are here.
Listed(Result<Vec<SandboxInfo>>, Vec<String>),
/// package caches are here; and the disk's free MiB, when it measured
/// it again after letting saved states go.
Listed(Result<Vec<SandboxInfo>>, Vec<String>, Option<u64>),
/// The sweep removed a sandbox, or failed to, and measured the disk
/// again.
Removed {
Expand Down Expand Up @@ -365,7 +366,35 @@ impl Daemon {
}
self.sweeping = true;
let (ctx, chores) = (self.ctx.clone(), self.chores_tx.clone());
// While the disk is low, the VMs' saved states go first: their
// sandboxes boot again from their disks, and lose no more. A host
// that keeps none (`snapshots = false`) lets go of those it kept.
let low = self.low_on_disk();
let keeps_states = self.ctx.cfg.firecracker.snapshots;
let in_use: HashSet<String> = self
.sessions
.keys()
.chain(self.pending_starts.keys())
.map(|id| sandbox_name(id.as_str()))
.collect();
tokio::spawn(async move {
// What that freed counts before any sandbox goes for room.
let mut measured = None;
if low || !keeps_states {
let freed = ctx.driver.drop_saved_states(&in_use).await;
Comment thread
fctl-review[bot] marked this conversation as resolved.
Resolved
if freed > 0 {
if low {
tracing::info!(
"let go of the saved states of stopped sandboxes for room on the disk: {freed} MiB"
);
} else {
tracing::info!(
"let go of the saved states of stopped sandboxes, which snapshots = false keeps none of: {freed} MiB"
);
}
measured = ctx.disk_free_mb().await;
}
}
let listed = ctx.driver.list().await;
let caches = match &listed {
Ok(_) => ctx
Expand All @@ -378,7 +407,7 @@ impl Daemon {
}),
Err(_) => Vec::new(),
};
let _ = chores.send(Chore::Listed(listed, caches));
let _ = chores.send(Chore::Listed(listed, caches, measured));
});
}

Expand Down Expand Up @@ -657,8 +686,17 @@ impl Daemon {

fn on_chore(&mut self, chore: Chore) {
match chore {
Chore::Listed(Ok(list), caches) => self.sweep_listed(list, caches),
Chore::Listed(Err(e), _) => {
Chore::Listed(Ok(list), caches, measured) => {
if measured.is_some() {
self.note_disk(measured);
}
self.sweep_listed(list, caches);
}
Chore::Listed(Err(e), _, measured) => {
// What letting saved states go freed counts all the same.
if measured.is_some() {
self.note_disk(measured);
}
tracing::warn!("listing sandboxes: {e:#}");
self.sweeping = false;
}
Expand Down Expand Up @@ -1528,10 +1566,11 @@ impl Daemon {
let (ctx, chores) = (self.ctx.clone(), self.chores_tx.clone());
tokio::spawn(async move {
let sb = ctx.driver.handle(&name);
if let Err(e) = ctx.driver.stop(&sb).await {
let (stopped, removed) = ctx.driver.finish(&sb, destroy).await;
if let Err(e) = stopped {
tracing::warn!("stopping {name}: {e:#}");
}
if destroy && let Err(e) = ctx.driver.remove(&sb).await {
if let Err(e) = removed {
tracing::warn!("removing {name}: {e:#}");
}
let ended = HostToFleet::SessionEnded {
Expand Down
Loading