Skip to content

Support arbitrary network driver options in wslc network create#40859

Open
beena352 wants to merge 10 commits into
microsoft:masterfrom
beena352:user/beenachauhan/feat/wslc-network-arbitrary-driver-opts
Open

Support arbitrary network driver options in wslc network create#40859
beena352 wants to merge 10 commits into
microsoft:masterfrom
beena352:user/beenachauhan/feat/wslc-network-arbitrary-driver-opts

Conversation

@beena352

@beena352 beena352 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Adds typed CLI flags (--internal, --subnet, --gateway) to wslc network create, replacing the old behavior where these were passed as generic driver options. Arbitrary driver options are forwarded verbatim to Docker via --opt key=value, matching Docker's pass-through behavior.

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

Problem: Network creation options like subnet, gateway, and internal were passed as generic driver opts, with no discoverability. Arbitrary Docker driver options were silently dropped.
Changes:

  • wslc.idl: Added BOOL Internal, LPCSTR Subnet, LPCSTR Gateway to WSLCNetworkOptions
  • ArgumentDefinitions.h: Added --internal, --subnet, --gateway CLI arguments
  • NetworkTasks.cpp / NetworkService.cpp: Map typed flags to IDL struct fields
  • WSLCSession.cpp:
  • Validates --gateway requires --subnet
  • Forwards all --opt driver options verbatim to Docker via request.Options
  • docker_schema.h / wslc_schema.h: Added Options field to CreateNetwork and Network structs

Validation Steps Performed

Copilot AI review requested due to automatic review settings June 19, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends WSLC network management to support arbitrary Docker network driver options end-to-end (create → inspect JSON output → session recovery), while still treating a small set of reserved keys (Internal, Subnet, Gateway) as typed inputs with strict casing to avoid silent misinterpretation.

Changes:

  • Allow non-reserved DriverOpts to pass through to Docker’s CreateNetwork.Options, while rejecting case-mismatches for reserved keys.
  • Persist and surface network Options in WSLC’s in-memory metadata and JSON schema (wslc_schema::Network), including after session recovery.
  • Add/adjust Windows tests to validate arbitrary options round-trip and recovery behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/windows/WSLCTests.cpp Updates invalid-option expectations (case-mismatch only for reserved keys) and adds coverage for arbitrary driver options + recovery persistence.
src/windows/wslcsession/WSLCSession.cpp Implements reserved-key case-mismatch validation, forwards non-reserved options to Docker, and stores/returns Options on inspect and recovery.
src/windows/wslcsession/WSLCNetworkMetadata.h Extends the cached network entry to include Options.
src/windows/inc/wslc_schema.h Adds optional Options to WSLC inspect-network JSON schema.
src/windows/inc/docker_schema.h Adds optional Options to Docker network create/inspect schema used by the client.

@beena352 beena352 changed the title Support arbitrary network driver options in wslc create/inspect/recovery Support arbitrary network driver options in wslc network create Jun 19, 2026
@beena352 beena352 requested a review from Copilot June 19, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/windows/wslcsession/WSLCSession.cpp Outdated
Comment thread src/windows/wslcsession/WSLCSession.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

@beena352 beena352 marked this pull request as ready for review June 19, 2026 22:35
@beena352 beena352 requested a review from a team as a code owner June 19, 2026 22:35
Copilot AI review requested due to automatic review settings June 19, 2026 22:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread localization/strings/en-US/Resources.resw Outdated
Comment thread localization/strings/en-US/Resources.resw Outdated
…eenachauhan/feat/wslc-network-arbitrary-driver-opts
@beena352 beena352 marked this pull request as draft June 29, 2026 21:30
Copilot AI review requested due to automatic review settings June 29, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/windows/wslcsession/WSLCSession.cpp
Comment thread src/windows/wslcsession/WSLCSession.cpp
Comment thread test/windows/WSLCTests.cpp
Copilot AI review requested due to automatic review settings June 29, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread localization/strings/en-US/Resources.resw Outdated
Comment thread localization/strings/en-US/Resources.resw
Comment thread test/windows/WSLCTests.cpp
Comment thread test/windows/WSLCTests.cpp
Comment thread src/windows/wslcsession/WSLCSession.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/windows/wslcsession/WSLCSession.cpp
@beena352 beena352 marked this pull request as ready for review June 30, 2026 00:52

@dkbennett dkbennett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, minor non-blocking comment

Argument::Create(ArgType::Driver, std::nullopt, std::nullopt, Localization::WSLCCLI_NetworkDriverOptionDescription()),
Argument::Create(ArgType::Options, false, NO_LIMIT),
Argument::Create(ArgType::Label, false, NO_LIMIT, Localization::WSLCCLI_NetworkLabelArgDescription()),
Argument::Create(ArgType::Internal),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: for non-positional / forward args prefer to keep these in alphabetical order

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.

4 participants