refactor(shim): precompute guest rootfs before task create#702
Draft
sidneychang wants to merge 2 commits into
Draft
refactor(shim): precompute guest rootfs before task create#702sidneychang wants to merge 2 commits into
sidneychang wants to merge 2 commits into
Conversation
✅ Deploy Preview for urunc canceled.
|
…nc-dev#565) Merge com.urunc.unikernel.* keys from the container image into bundle config.json when the OCI spec is missing them, using a containerd session before task create. Signed-off-by: sidneychang <2190206983@qq.com>
Select guest rootfs in the shim from CreateTask rootfs mounts and bundle annotations, persist the result in config.json, and consume it at runtime Exec with a podman fallback when the internal annotation is absent. Signed-off-by: sidneychang <2190206983@qq.com>
Contributor
Author
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.
Description
This PR precomputes guest rootfs in the urunc containerd task shim before inner
TaskService.Createmountsbundle/rootfs, so block-backed snapshots (e.g. devmapper) can be selected without relying ongetMountInfoon an unmounted path.Problem (#684)
Previously, guest rootfs was chosen only in runtime
Exec(). For containerd,bundle/rootfsis not mounted yet at shimCreateTasktime, so block device discovery viagetMountInfowas unreliable. Selection must useCreateTaskrootfs mounts instead.Solution
ChooseRootfsin the shim usingr.Rootfs(viaBlockFromRootfsMountsfor single/dev/*device mounts) plus bundle annotationscom.urunc.internal.rootfs.paramsinconfig.jsonExecconsumes that annotation; podman / direct urunc still fall back toChooseRootfsat runtime when it is absentMkdirAll/ mount);monRootfsis still created inExecRootfs logic is consolidated in
pkg/unikontainers/rootfs.go(ChooseRootfs,selectRootfs, encode/decode).Note on #565
The shim
Createpath currently also calls annotation injection from image metadata (#565) so rootfs selection has complete unikernel annotations during development. That logic is temporary until #565 lands upstream; we will drop or rework this integration after #565 is merged.Related issues
How was this tested?
LLM usage
Cursor
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).