CLI: Initial support for volume commands#40139
CLI: Initial support for volume commands#40139AmelBawa-msft wants to merge 1 commit intofeature/wsl-for-appsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial WSLC CLI support for managing named volumes (create/list/inspect/remove) and validates the new --driver argument, with E2E coverage to ensure named volumes can be used across containers.
Changes:
- Introduces new
wslc volumecommand group with create/remove/inspect/list subcommands. - Adds volume task/service/model plumbing to call existing session COM volume APIs and render output (table/json/quiet).
- Extends Windows E2E tests to validate named volume persistence across container runs/creates.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp | Adds E2E scenarios validating named-volume write/read and multi-container persistence with container run. |
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Adds E2E scenarios validating named-volume persistence across container create/start and subsequent containers. |
| src/windows/wslc/tasks/VolumeTasks.h | Declares volume task entry points used by the new commands. |
| src/windows/wslc/tasks/VolumeTasks.cpp | Implements volume tasks: create/delete/list/inspect, including output formatting (table/json/quiet). |
| src/windows/wslc/services/VolumeService.h / .cpp | Adds service wrapper over session COM APIs for volume CRUD/list/inspect. |
| src/windows/wslc/services/VolumeModel.h | Introduces VolumeInformation model for list output + JSON serialization. |
| src/windows/wslc/core/ExecutionContextData.h | Adds Data::Volumes mapping to store volume lists in the execution context. |
| src/windows/wslc/commands/VolumeCommand.* | Adds root volume command and wires up subcommands. |
| src/windows/wslc/commands/Volume*Command.cpp | Implements argument sets, descriptions, validation, and task pipelines for each volume subcommand. |
| src/windows/wslc/commands/RootCommand.cpp | Registers volume under the CLI root. |
| src/windows/wslc/arguments/ArgumentDefinitions.h | Adds VolumeDriver (--driver/-d) and positional VolumeName. |
| src/windows/wslc/arguments/ArgumentValidation.h / .cpp | Adds validation for the --driver argument (currently supports vhd). |
| localization/strings/en-US/Resources.resw | Adds localized help text for volume commands and new arguments. |
| --*/ | ||
| #pragma once | ||
| #include "CLIExecutionContext.h" | ||
| #include "Task.h" |
There was a problem hiding this comment.
Task.h is included but not used in this header (unlike ContainerTasks.h, which defines a Task-derived type). Dropping the unused include would reduce unnecessary coupling and rebuilds.
| #include "Task.h" |
|
|
||
| #pragma once | ||
|
|
||
| #include <wslc.h> |
There was a problem hiding this comment.
<wslc.h> doesn’t appear to be needed for VolumeInformation (it only uses std::string and the nlohmann JSON macro). Consider removing the unused include to keep the model header lightweight, consistent with other model headers like ImageModel.h.
| #include <wslc.h> |
f5e1b45 to
b851ae9
Compare
Summary of the Pull Request
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed