Reap abandoned build volumes and clarify stale-volume errors#178
Open
jetm wants to merge 2 commits into
Open
Conversation
Each project gets a per-project docker volume (avo-<uuid>) recorded in its .avocado-state file. Deleting the project directory by hand drops the folder but not the volume, so the volumes pile up unbounded: nothing reclaimed them short of a user knowing to run `avocado prune`. Sweep provably-abandoned avo-* volumes at the moment a fresh volume is minted in get_or_create_volume. That is the natural GC point (a new project is starting) and the only path already holding a container-tool handle, so init and the other pure-filesystem commands stay docker-free. The sweep is best-effort: a daemon-down or held-volume failure is swallowed so it can never block a build. Reuse a single classifier, avo_abandonment_reason, from both the reap and `avocado prune` so the two paths cannot drift on what "abandoned" means.
The rootfs build copies the sysroot into rootfs-work and immediately runs the user-creation step, which greps /etc/passwd. When a build volume is stale or a prior install was interrupted, the sysroot can carry /usr but not /etc/passwd; the copy then also lacks it, and the user surfaced a cryptic `grep: .../rootfs-work/etc/passwd: No such file` with no hint at the cause or the fix. Check for the base rootfs /etc/passwd right after the copy, before the user-creation step, and exit with a message that names the stale-volume cause and the recovery. Point at both `avocado clean` and `avocado prune`: clean drops the active project's volume, but a reporter found clean alone insufficient and needed prune to clear an abandoned volume that was shadowing the build. Signed-off-by: Javier Tia <javier@peridio.com>
Contributor
Author
|
@lee-reinhardt could you take a look at this one when you get a chance? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Each project gets a per-project Docker volume (
avo-<uuid>) recorded in its.avocado-statefile. Deleting a project directory by hand drops the folder but not the volume, soavo-*volumes accumulate unbounded. Worse, a stale or half-populated volume makesavocado buildfail duringruntime build devwith a crypticgrep: .../rootfs-work/etc/passwd: No such file, naming neither the cause nor the fix.Solution
Reclaim provably-abandoned
avo-*volumes at the moment a fresh volume is minted, and guard the rootfs build so a half-populated sysroot fails fast with an actionable message instead of the grep noise.Key changes
avo-*volumes inget_or_create_volume(the natural GC point, and the only path already holding a container-tool handle, soinitand the pure-filesystem commands stay docker-free). Best-effort: a daemon-down or held-volume failure is swallowed and never blocks a build.avo_abandonment_reason, between the reap andavocado pruneso the two paths cannot drift on what "abandoned" means.rootfs-worklacks/etc/passwdafter the sysroot copy, exit with a message pointing atavocado cleanandavocado prune.Reviewer notes
install/buildnow delete provably-deadavo-*volumes (source dir gone, no.avocado-state, or state pointing at a different volume). Active project volumes are never touched.