Skip to content

Add --cpus, --memory, and --ulimit options to wslc container create/run#40727

Open
AmelBawa-msft wants to merge 5 commits into
masterfrom
user/amelbawa/resources
Open

Add --cpus, --memory, and --ulimit options to wslc container create/run#40727
AmelBawa-msft wants to merge 5 commits into
masterfrom
user/amelbawa/resources

Conversation

@AmelBawa-msft
Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Wires up the --cpus, -m/--memory, and --ulimit options on wslc container create and run

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings June 5, 2026 23:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/windows/wslc/arguments/ArgumentValidation.cpp Outdated
Comment thread test/windows/wslc/WSLCCLIResourceLimitsParserUnitTests.cpp
@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review June 6, 2026 01:04
@AmelBawa-msft AmelBawa-msft requested a review from a team as a code owner June 6, 2026 01:04
Copilot AI review requested due to automatic review settings June 6, 2026 01:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread src/windows/wslc/arguments/ArgumentValidation.cpp Outdated
Comment thread test/windows/wslc/WSLCCLIResourceLimitsParserUnitTests.cpp
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.

2 participants