Skip to content

[shimV2] adds the container spec builder#2661

Open
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:container_builder
Open

[shimV2] adds the container spec builder#2661
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:container_builder

Conversation

@rawahars
Copy link
Copy Markdown
Contributor

@rawahars rawahars commented Apr 6, 2026

Summary

This pull request adds new functionality for resource reservation in the LCOW (Linux Containers on Windows) container builder, specifically for handling device and layer reservations, and introduces comprehensive documentation and tests for these features.

Resource reservation logic for LCOW containers:

  • Added reserveAndUpdateDevices to lcow/devices.go to reserve vPCI devices, update device IDs in the OCI spec to VMBus channel GUIDs, and return partial results on failure for proper cleanup.
  • Added parseAndReserveLayers and helpers to lcow/layers.go to parse rootfs/layer folders, reserve SCSI slots for read-only and scratch layers, and return a layer plan with proper cleanup on partial failure.
  • Reservation logic for mounts

Testing and documentation:

  • Added comprehensive unit tests in lcow/devices_test.go covering empty device lists, single/multiple devices, virtual function indices, unsupported types, and partial failure scenarios for reserveAndUpdateDevices.
  • Added a detailed package doc (lcow/doc.go) explaining the two-phase resource reservation and spec generation process for LCOW containers, including usage and cleanup strategy.

@rawahars rawahars requested a review from a team as a code owner April 6, 2026 05:13
Adds the new `internal/builder/container` package
for container resource planning and spec construction.

- adds core container builder types and resource planning logic
- adds LCOW-specific implementations for devices, layers, mounts, reserve, and specs
- adds package documentation and generated mocks used by tests
- adds comprehensive unit tests across core and LCOW components

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars force-pushed the container_builder branch from 3928c47 to 4bff823 Compare April 6, 2026 06:14
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