Skip to content

Add support for larger number of larger using GPT#181

Open
dmcgowan wants to merge 2 commits into
containerd:mainfrom
dmcgowan:gpt
Open

Add support for larger number of larger using GPT#181
dmcgowan wants to merge 2 commits into
containerd:mainfrom
dmcgowan:gpt

Conversation

@dmcgowan

@dmcgowan dmcgowan commented May 7, 2026

Copy link
Copy Markdown
Member

Use gpt to layout erofs partitions into a single vmdk device to attach
all erofs devices in a single block device.

Copilot AI review requested due to automatic review settings May 7, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new strategy for handling many EROFS layer mounts by packing plain (single-device) EROFS mounts into a single GPT-partitioned VMDK, reducing virtio-blk device consumption while preserving existing behavior for multi-device EROFS mounts.

Changes:

  • Defer and batch plain EROFS mounts in the shim; above a threshold, generate/attach one GPT VMDK and mount partitions (e.g., /dev/vda1, /dev/vda2, …).
  • Introduce GPT layout generation (header/tail blobs, partition table) and a GPT-aware VMDK descriptor writer that can use ZERO extents (or a padding-file fallback).
  • Add unit tests covering GPT layout/descriptor generation and mount transformation behavior; patch libkrun build to use a locally patched imago crate for VMDK extent-boundary correctness.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/shim/task/mount.go Defers plain EROFS mounts and conditionally packs them into a GPT-partitioned VMDK; keeps multi-device EROFS behavior inline.
internal/shim/task/mount_test.go Adds coverage for plain vs multi-device EROFS and GPT packing threshold behavior.
internal/erofs/vmdk.go Adds GPT VMDK descriptor emission (ZERO extents / padding fallback) and helper blob/pad writers.
internal/erofs/gpt.go Implements deterministic GPT layout computation and header/tail blob writers for partitioned layer disks.
internal/erofs/gpt_test.go Tests GPT layout correctness, determinism, CRCs, and header/tail structure.
internal/erofs/vmdk_gpt_test.go Tests GPT VMDK descriptor extent ordering and the to-file writer (aux file generation).
internal/erofs/no_copy_check_test.go Adds an informational “no data copy” test that currently runs as a normal unit test.
Dockerfile Patches imago in the libkrun build stage to fix extent-boundary reads for GPT VMDKs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/erofs/no_copy_check_test.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 73 changed files in this pull request and generated 2 comments.

Comment thread internal/shim/task/mount.go
Comment thread internal/shim/task/mount.go
@dmcgowan dmcgowan force-pushed the gpt branch 2 times, most recently from b9946ac to 669ca9a Compare June 7, 2026 01:29
Copilot AI review requested due to automatic review settings June 7, 2026 01:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 71 changed files in this pull request and generated 3 comments.

Comment thread internal/shim/task/mount.go Outdated
if len(disk) > 36 {
disk = disk[:36]
}
mergedfsPath := filepath.Join(bundleDir, "merged_fs.vmdk")
Comment thread internal/shim/task/mount.go
Comment thread test/shim/shim_test.go Outdated
Comment thread internal/erofs/gpt.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 71 changed files in this pull request and generated 3 comments.

Comment thread internal/erofs/vmdk.go
Comment thread test/shim/shim_test.go Outdated
Comment thread internal/shim/task/mount.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread Dockerfile
Comment thread internal/erofs/vmdk.go
Comment thread internal/erofs/vmdk.go
@dmcgowan dmcgowan marked this pull request as ready for review June 8, 2026 18:30
Copilot AI review requested due to automatic review settings June 8, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +256 to +270
// Write the GPT VMDK and its auxiliary blobs into bundleDir so the
// shim does not mutate the source image directories. Cache by
// stat-check: setupMounts may be called more than once per bundle
// (e.g. on restore) but the layer set for a given bundle is fixed.
gptPath := filepath.Join(bundleDir, "merged_fs_gpt.vmdk")
if _, err := os.Stat(gptPath); err != nil {
if !os.IsNotExist(err) {
log.G(ctx).Warnf("failed to stat %v: %v", gptPath, err)
return fmt.Errorf("erofs gpt vmdk: %w", errdefs.ErrNotImplemented)
}
if err := erofs.DumpGPTVMDKDescriptorToFile(gptPath, 0xfffffffe, sources); err != nil {
log.G(ctx).Warnf("failed to generate %v: %v", gptPath, err)
return fmt.Errorf("erofs gpt vmdk: %w", errdefs.ErrNotImplemented)
}
}
dmcgowan added 2 commits June 8, 2026 13:01
Signed-off-by: Derek McGowan <derek@mcg.dev>
Use gpt to layout erofs partitions into a single vmdk device to attach
all erofs devices in a single block device.

Signed-off-by: Derek McGowan <derek@mcg.dev>
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.

3 participants