Add --cpus, --memory, and --ulimit options to wslc container create/run#40727
Open
AmelBawa-msft wants to merge 5 commits into
Open
Add --cpus, --memory, and --ulimit options to wslc container create/run#40727AmelBawa-msft wants to merge 5 commits into
AmelBawa-msft wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires Docker-compatible resource limit flags (--cpus, -m/--memory, --ulimit) through the wslc container create and wslc container run CLI surface, including validation, service plumbing, and test coverage.
Changes:
- Added new CLI arguments (
cpus,memory,ulimit) to container create/run, including localized help/error strings. - Implemented parsing/validation for CPU nano-shares and ulimit specs, and passed these options into container creation.
- Added unit tests for parsing and E2E tests validating the limits are reflected in
inspect.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/WSLCCLIResourceLimitsParserUnitTests.cpp | Adds unit tests for --cpus and --ulimit parsing/validation helpers. |
| test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp | Adds E2E coverage for container run resource limits and updates help text expectations. |
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Updates help text expectations for new create options. |
| src/windows/wslc/tasks/ContainerTasks.cpp | Maps parsed CLI args into ContainerOptions for create/run flows. |
| src/windows/wslc/services/ContainerService.cpp | Plumbs MemoryBytes, NanoCpus, and Ulimits into the container launcher. |
| src/windows/wslc/services/ContainerModel.h | Extends ContainerOptions with memory/cpu/ulimit fields. |
| src/windows/wslc/commands/ContainerRunCommand.cpp | Registers new arguments for container run. |
| src/windows/wslc/commands/ContainerCreateCommand.cpp | Registers new arguments for container create. |
| src/windows/wslc/arguments/ArgumentValidation.h | Declares new validation/parsing helpers for CPUs and ulimits. |
| src/windows/wslc/arguments/ArgumentValidation.cpp | Implements --cpus parsing and --ulimit parsing/validation logic. |
| src/windows/wslc/arguments/ArgumentDefinitions.h | Adds argument definitions for cpus, memory, ulimit. |
| localization/strings/en-US/Resources.resw | Adds localized descriptions and error messages for the new options. |
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.
Summary of the Pull Request
Wires up the
--cpus,-m/--memory, and--ulimitoptions onwslc container createandrunPR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed