Skip to content

Return non vhd volumes in container inspect - #41335

Open
Blue (OneBlue) wants to merge 3 commits into
masterfrom
user/oneblue/mounts-guest-volumes
Open

Return non vhd volumes in container inspect#41335
Blue (OneBlue) wants to merge 3 commits into
masterfrom
user/oneblue/mounts-guest-volumes

Conversation

@OneBlue

@OneBlue Blue (OneBlue) commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This change adds logic to return guest volumes in the container inspect's output. For now, the source path is set to an empty string since we don't want to expose VM paths, but this can be revisited later if needed

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

@OneBlue
Blue (OneBlue) requested a review from a team as a code owner August 12, 2026 22:05
Copilot AI lite review requested due to automatic review settings August 12, 2026 22:05
@OneBlue
Blue (OneBlue) requested a review from a team as a code owner August 12, 2026 22:05

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 updates WSLC’s container inspect output to include Docker-managed volume mounts (guest/named/anonymous and image-defined VOLUMEs) while intentionally not exposing the utility VM’s internal source paths (emitting Source: null). It also updates schema definitions and expands tests to validate the new inspect behavior.

Changes:

  • Extend Docker and WSLC inspect schemas to include mount Name and make WSLC mount Source nullable.
  • Populate inspect Mounts with Docker-reported volume mounts while continuing to map host bind mounts from WSLC’s host-side tracking.
  • Add/adjust Windows and E2E tests to validate anonymous and Dockerfile-defined volumes appear in inspect output with Source unset.

Reviewed changes

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

Show a summary per file
File Description
test/windows/WSLCTests.cpp Adds new inspect coverage for anonymous volumes and Dockerfile VOLUME mounts; updates existing mount assertions for nullable Source.
test/windows/wslc/e2e/WSLCE2EContainerRemoveTests.cpp Switches anonymous-volume detection to use container inspect output rather than before/after volume list diffs.
src/windows/wslcsession/WSLCContainer.cpp Updates inspect construction to append Docker volume mounts without exposing utility-VM source paths.
src/windows/inc/wslc_schema.h Updates WSLC inspect mount schema to include Name and nullable Source.
src/windows/inc/docker_schema.h Extends Docker inspect schema parsing to include Mounts and mount Name.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/windows/wslc/e2e/WSLCE2EContainerRemoveTests.cpp
Comment thread src/windows/wslcsession/WSLCContainer.cpp
Comment thread src/windows/inc/wslc_schema.h

@dkbennett David Bennett (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.

Normally I like the semantic clarity of making source optional so intent is clear, in this case it is a public schema where Source is already expected to be a string and perhaps more importantly, Docker itself uses empty string when no source applies. Nullable is cleaner conceptually but introduces a compatibility risk. If we want our json output to be consumable by tooling that expects Docker-like output, this is a change that could break that tooling.

So in the interest of Docker alignment & compat, I would recommend leaving Source as non-nullable string and leaving it empty for anonymous volumes.

Comment thread src/windows/inc/wslc_schema.h Outdated
Copilot AI review requested due to automatic review settings August 13, 2026 21:02

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 no new comments.

Suppressed comments (2)

src/windows/wslcsession/WSLCContainer.cpp:1632

  • The comment says "TODO: Return mounts once --mount is implemented", but this block already returns volume mounts today (guest volumes and Dockerfile VOLUME). This TODO is misleading; reword it to reflect the current behavior and the actual limitation (only Type == volume mounts are surfaced; other mount types are still omitted).
        // This block covers non-vhd volumes. This includes:
        // - Guest volumes mounted via -v
        // - Volumes mounted as part of the image (via VOLUME)
        //
        // TODO: Return mounts once --mount is implemented.

src/windows/inc/wslc_schema.h:36

  • PR description says the volume mount Source is set to null, but the schema uses std::string Source, so JSON serialization will emit an empty string ("Source": "") rather than null. If consumers need an actual JSON null, Source should be std::optional<std::string> and bind mounts should explicitly populate it; otherwise, consider updating the PR description/expectations to match the empty-string behavior.
    std::string Type;
    std::string Name;
    std::string Source;
    std::string Destination;

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