baseosmgr: check rootfs size, not whole image#6044
Draft
eriknordmark wants to merge 2 commits into
Draft
Conversation
f2a6866 to
3b9f91d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6044 +/- ##
==========================================
+ Coverage 20.72% 21.13% +0.40%
==========================================
Files 504 514 +10
Lines 92768 94492 +1724
==========================================
+ Hits 19230 19970 +740
- Misses 71916 72719 +803
- Partials 1622 1803 +181 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3b9f91d to
2a2d346
Compare
ef55013 to
fb0f3ac
Compare
A caller that needs an image's layers — their sizes, media types and annotations — should not reach into containerd or re-parse manifests itself. Add GetImageLayers(reference), which resolves the reference to its manifest (descending a platform index when needed) and returns the layer descriptors, keeping OCI manifest parsing inside the cas package. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A base-OS update was rejected when the content tree's whole download size exceeded the rootfs partition. That total is not what lands in the partition: only the rootfs — the image's disk-root layer — is written there, while a split-rootfs image also carries an Extension that is extracted to /persist. A valid image was therefore wrongly rejected with "Image size ... greater than partition size". Drop that whole-image pre-activation check and instead, just before writing, compare the disk-root layer size against the partition capacity, failing fast with a clear error if it does not fit. The rootfs is a squashfs stored as a raw (uncompressed) layer, so its manifest size is exactly the bytes written. The layer size comes from the image manifest via cas.GetImageLayers. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fb0f3ac to
4c38292
Compare
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
doBaseOsActivaterejected a base-OS update whenever the content tree's totaldownload size exceeded the rootfs partition. But that total is not what lands in
the partition — only the rootfs (the disk-root layer) is written there. An image
may carry additional disks beyond the rootfs (for example the split-rootfs
Extension, which is extracted to
/persist), so a perfectly valid image waswrongly rejected with
doBaseOsActivate: Image size <N> bytes greater than partition size <M> bytes.The whole-image pre-activation check is removed and replaced by a check against
what is actually written. Just before writing the partition,
zbootlooks up thesize of the image's disk-root layer from its manifest and fails fast if that
exceeds the partition capacity. Because the rootfs is a squashfs stored as a raw
(uncompressed) layer, the manifest descriptor size equals the bytes written, so
the bound is exact. The check is image-shape agnostic — monolithic, multi-disk
and split-rootfs images alike — because it only ever measures the rootfs. If the
image has no disk-root layer (an unexpected manifest shape) the check is skipped
rather than blocking the install.
Reading the disk-root layer size needs the image's manifest, so this also adds a
GetImageLayersaccessor to the CAS interface — manifest parsing stays in theCAS layer rather than leaking go-containerregistry into
zboot.Note: this check runs on the EVE instance performing the activation, so the fix
takes effect for devices already running an EVE that contains it.
How to test and validate this PR
fails fast, before the multi-gigabyte pull and write, with
rootfs does not fit: rootfs <N> bytes exceeds partition <part> size <M> bytes.size check even though the whole-image size exceeds the partition, because only
the Core (disk-root) is measured.
Changelog notes
Fixes base-OS updates being wrongly rejected with an "image size greater than
partition size" error when the downloaded image is larger than the rootfs
partition but the root filesystem itself fits within it.
PR Backports
Draft — backporting to LTS branches at maintainer discretion.
🤖 Generated with Claude Code