Skip to content

feat: mark pulled clone sources and reclaim them under any name - #121

Merged
CMGS merged 1 commit into
mainfrom
reclaim-owned-clone-sources
Sep 29, 2026
Merged

CMGS merged 1 commit into
mainfrom
reclaim-owned-clone-sources

Conversation

@CMGS

@CMGS CMGS commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Gap

The snapshot reclaimer only considers vk- names. A clone source pulled from any other repository, such as simular/osworld-ref:ref12 or a default-tag simular/golden, is never reclaimed after the last pod stops cloning from it. The name alone cannot be trusted to widen the rule: an operator may have imported a local-only snapshot by hand under the same kind of name, and deleting it would lose data that exists nowhere else.

Change

  • Ownership is recorded, not guessed. Puller.PullSnapshot and Runtime.SnapshotImport take a description; the clone-source pull (ensureSnapshot) passes vk-cocoon clone source, and CocoonCLI.SnapshotImport forwards it as cocoon snapshot import --description (cocoon stores it and snapshot list reports it). Hibernate wake imports pass none.
  • vm.Snapshot gains Description.
  • The reclaimer removes a marked snapshot once no pod on the node clones from it, whatever its name, without a registry lookup: the registry still holds it. In-use protection is unchanged.
  • Unmarked snapshots outside the vk- names are never touched. The colon rule from fix: reclaim clone-source copies no pod on the node clones from #120 stays for vk- copies pulled before the mark existed.
  • docs/reconcile.md describes the reclaimer's rules, including fix: reclaim clone-source copies no pod on the node clones from #120's, which it had not yet.

Tests

  • TestTheReclaimerDropsMarkedCloneSourcesUnderAnyName: a marked simular/osworld-ref:ref12 no pod uses is removed (fails on main: removed [], want [...]); marked and in use is kept; the same name unmarked and an unmarked default-tag name are kept. The registry double cannot answer, so the removal cannot depend on it.
  • The concurrent ensureSnapshot test now also asserts the single import carried the clone-source mark.
  • TestSnapshotImportPassesTheDescriptionOnlyWhenSet: the CLI argv omits --description when empty and carries it when set (fake cocoon binary via the ForkLock helper from test: write fake cocoon binaries under ForkLock #119).

Gates

make lint 0 issues on linux and darwin, make fmt-check clean, asl ./... clean on both GOOS, go test -race ./... green (GOWORK=off); the three touched packages also pass three race runs on Linux. Not yet run on hardware. Hot path: none; one extra argv pair per clone-source pull.

The reclaimer only looked at vk- names, so a clone source pulled from another
repository (simular/osworld-ref:ref12, or a default-tag simular/golden) stayed
on the node forever once no pod used it. A name alone cannot tell such a copy
from a snapshot an operator imported by hand, which may exist nowhere else.

vk-cocoon now imports every clone-source pull with the description
"vk-cocoon clone source" (cocoon's snapshot import already takes one and
snapshot list reports it). The reclaimer removes a marked snapshot once no pod
on the node clones from it, whatever its name; the registry still holds it.
Unmarked snapshots outside the vk- names are never touched, and the #120 colon
rule stays for vk- copies pulled before the mark existed. Hibernate wake
imports stay unmarked. docs/reconcile.md now describes both rules.
@CMGS
CMGS merged commit e09050b into main Sep 29, 2026
4 checks passed
@CMGS
CMGS deleted the reclaim-owned-clone-sources branch September 29, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant