Skip to content

A small Linux host can take container jobs: the disk hold, the disk stop and each job's disk are host settings - #87

Merged
codefusion-automerge[bot] merged 4 commits into
mainfrom
feat/disk-settings
Nov 12, 2026
Merged

codefusion-automerge[bot] merged 4 commits into
mainfrom
feat/disk-settings

Conversation

@XeonFX

@XeonFX XeonFX commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

A small Linux host can now run container jobs: the free disk under which no job starts, the one under which a job is stopped, and each job's disk are settings of the host's file.

Why: heimforge's dal1 (12 cores, 11 GB, no KVM) is to run CI with --sandbox container on rootless Podman, its Runner user's home an XFS of about 10 to 14 GB. With the fixed 25 GiB hold it never takes a job, and each container's layer is allowed 40 GiB.

What changed

  • disk_hold_gb, disk_stop_gb and job_disk_gb in the settings file (GB of 2^30 bytes, numbers like ci_memory_gb) become the budget's Limits (disk_hold_bytes, disk_evict_bytes, job_disk_bytes) and go through Settings::limited, the same path as ci_cpus and ci_memory_gb. host-setup.sh install --settings writes them like any other key; a running Runner takes up the changed file as usual.
  • Defaults are unchanged: 25, 5 and 40 GiB (Settings::DISK_HOLD, DISK_EVICT, JOB_DISK). Nothing changes for a host that does not set them.
  • Each job's disk now comes from Settings::job_disk_bytes. MachineConfig::scratch_bytes is gone. In container mode it is the StorageOpt size and the SizeRw watch, as before.
  • Checks:
    • disk_stop_gb must be at least 1 GiB and no more than the hold. A hold set alone lowers the default stop to itself. A hold under 1 GiB is reported against the hold, not the stop.
    • The job's disk must be 4 to 512 GiB.
    • Against the state folder's file system, via the new Platform::disk_bytes and cf_daemon::budget_settings: a hold that is not under the file system's size is refused ("no job would ever start"), and so is a job's disk larger than the file system. A state folder not made yet is measured at its nearest existing parent. Only values the owner set are checked against the disk, so a host on the defaults starts on any disk as before.
    • In container mode, a hold plus one job's disk larger than the file system is a warning (DiskShort), not a refusal. It goes to the log, and check prints it on the new disk line. A job's disk is a ceiling, not a reservation, and the stop limit still protects the host, so refusing would keep a working host idle.
  • check prints the disk limits and the file system's size.

Tests

  • crates/budget/tests/disk.rs:
    • the defaults on every kind of host, exact values;
    • the edges: 0, 1 byte, GiB-1, hold equal to stop, stop one byte over the hold, u64::MAX, job disk 4 GiB-1 / 512 GiB+1;
    • hold equal to the disk and greater than it refused; a byte under is accepted;
    • container shortfall to the byte; VM mode is never short;
    • a dal1-sized budget: it holds at 4 GiB free on the defaults, takes a job once the hold is 3 GiB, still takes one at exactly 3 GiB, holds a byte under it, and stops the writing job under the stop.
  • properties.rs: the model test now also draws random hold/stop limits.
  • Runner config.rs: each key's numbers, negative, zero, -0.0, over the max, strings, lists, objects, booleans, null.
  • Runner service.rs: a settings file's disk keys reach the budget, and a hold past the real tempdir's file system makes the file unusable.
  • daemon/tests/machines.rs: the job's JobRequest.scratch_bytes is the setting; the claim waits for disk under the hold.
  • vmhost/tests/driver.rs: a 6 GiB job's spec asks for layer_bytes of 6 GiB, and is held to it to the byte.
  • Each new test went red when the matching code was broken on purpose (11 mutations).

Not tested before merge: the Linux Platform::disk_bytes (LinuxHost::disk_total_bytes of the state folder) compiles and runs only on CI's Linux jobs, and the real XFS-quota home on dal1 is checked only once it runs there.

For the console

The console's settings command (SettingsChange) and the reported JobLimits do not carry these keys. Like ci_cpus and ci_memory_gb, they are set through the file (host-setup.sh --settings). To show and change them there, the console would need JobLimits fields for the three values (for example diskHoldGb, diskStopGb, jobDiskGb) and the keys in SettingsChange::from_args and ConfigFile::change.

disk_hold_gb, disk_stop_gb and job_disk_gb in the settings file become the
budget's Limits, as ci_memory_gb and ci_cpus do. The defaults stay 25, 5 and
40 GB. A hold or a job's disk the state folder's file system cannot hold is
refused; a container host whose hold and one job's disk do not fit it
together starts and says so.
@XeonFX
XeonFX marked this pull request as ready for review November 12, 2026 23:03
@XeonFX XeonFX added the automerge Merges itself once every check is green label Nov 12, 2026
@codefusion-automerge
codefusion-automerge Bot merged commit 74a2027 into main Nov 12, 2026
6 checks passed
@codefusion-automerge
codefusion-automerge Bot deleted the feat/disk-settings branch November 12, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Merges itself once every check is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant