Skip to content

Add WSLCVolumes class to track volumes with Docker event-driven synchronization#40300

Merged
kvega005 merged 728 commits intomicrosoft:masterfrom
kvega005:WslcVolumesManager
May 7, 2026
Merged

Add WSLCVolumes class to track volumes with Docker event-driven synchronization#40300
kvega005 merged 728 commits intomicrosoft:masterfrom
kvega005:WslcVolumesManager

Conversation

@kvega005
Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Refactors WSLC volume management into a dedicated WSLCVolumes class and replaces the old ContainerEventTracker with a broader DockerEventTracker that tracks both container and volume lifecycle events.

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

AmelBawa-msft and others added 30 commits March 24, 2026 00:12
* Save state

* Rethink image parsing to correctly handle different reference formats

* Foramt

* Fix merge

* Apply PR feedback

* Format

* Apply PR feedback

* Use a regex based parser

* Format

* Reset the test session after termination

* Fix test case

* Apply PR feedback
* Container cursor

* Update pull image callback

* Clang format
* Add volume alias

* Fix Tests
* Rename image delete to remove

* Clang format
* Initial support for WSLC E2E tests

* More E2E tests

* More E2E tests

* WIP

* CP exit code fix

* Enhance structure

* Added E2E file

* Clang format

* Added E2E test

* Enhance structure

* Clang format

* Update header comment

* Update wslc path

* Resolving copilot comments

* Added E2E test

* Pull latest

* Addressed comments

* Addressed comments

* Clang format

* Addressed comments

* Load image

* Addressed comments

* Pull latest

* Addressed comments

* E2E test for wslc container delete

* Addressed comments

* Resolving copilot comments

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Added E2E test

* Fix test

* Added E2E tests

* Added E2E tests

* Added E2E tests

* Added E2E tests

* Added E2E tests

* Added E2E tests

* Added E2E tests

* Resolve copilot comment

* Clang format

* Replace S_OK with 0

* Resolve copilot comment

* Addressed comments

* Resolve copilot comment

* Update test after latest changes
Implements `WslcSetProcessSettingsIOCallback` and the use of those inputs for both initial and subsequent processes.  A new thread is started to run the `MultiHandleWait` and the container/process objects hold a `shared_ptr` reference to it.  The caller must keep one of the objects alive for the callback thread to keep working.
---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: WSL localization <noreply@microsoft.com>
…4475)

* Init env

* Added E2E tests

* Clang format

* WIP

* Init tests

* Added UT

* Added more UT

* Added more E2E Tests

* Added more E2E Tests

* Code enhancement

* Added more E2E Tests

* Added more E2E Tests

* Added more E2E Tests

* Clang format

* Resolve copilot comment

* Addressed comments

* Fix test

* Addressed comments
* test: enable virtiofs tests and enable WSLG during testing (microsoft#14387)

* test: enable virtiofs tests and enable WSLG during testing

* test fix

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* chore(distributions): Almalinux auto-update - 20260311 14:52:02 (microsoft#14404)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix CVE-2026-26127: bump .NET runtime from 10.0.0 to 10.0.4 (microsoft#14421)

Addresses Dependabot alerts microsoft#10 and microsoft#11. The Microsoft.NETCore.App.Runtime
packages (win-x64 and win-arm64) at version 10.0.0 are vulnerable to a
denial of service via out-of-bounds read when decoding malformed Base64Url
input (CVSS 7.5 High). Bumped to 10.0.4 which includes the fix.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Notice change from build: 141806547 (microsoft#14423)

Co-authored-by: WSL notice <noreply@microsoft.com>

* Ship initrd.img in MSI using build-time generation via powershell script (microsoft#14424)

* Ship initrd.img in MSI using build-time generation via tar.exe

Replace the install-time CreateInitrd/RemoveInitrd custom actions with a
build-time step that generates initrd.img using the Windows built-in
tar.exe (libarchive/bsdtar) and ships it directly in the MSI.

The install-time approach had a race condition: wsl.exe could launch
before the CreateInitrd custom action completed, causing
ERROR_FILE_NOT_FOUND for initrd.img.

Changes:
- Add CMake custom command to generate initrd.img via tar.exe --format=newc
- Add initrd.img as a regular file in the MSI tools component
- Remove CreateInitrd/RemoveInitrd custom actions from WiX, DllMain,
  and wslinstall.def
- Remove CreateCpioInitrd helper and its tests (no longer needed)
- Update pipeline build targets to build initramfs instead of init

* pr feedback

* more pr feedback

* switch to using a powershell script instead of tar.exe

* powershell script feedback

* hopefully final pr feedback

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* virtiofs: update logic so querying virtiofs mount source does not require a call to the service (microsoft#14380)

* virtiofs: update logic so querying virtiofs mount source does not require a call to the service

* more pr feedback

* use std::filesystem::read_symlink

* pr feedback and use canonical path in virtiofs symlink

* make sure canonical path is always used

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* virtio networking: add support for ipv6 (microsoft#14350)

* VirtioProxy: Add IPv6 address, gateway, and route support

- Add PreferredIpv6Address field and GetBestGatewayV6* methods to NetworkSettings
- Extend GetHostEndpointSettings() to discover IPv6 unicast address and gateway
- Add UpdateIpv6Address() using ModifyGuestEndpointSettingRequest<IPAddress>
- Push IPv6 default route to guest via UpdateDefaultRoute(AF_INET6)
- Remove AF_INET6 early return in ModifyOpenPorts, use INETADDR_PORT()
- Add EndpointRoute::DefaultRoute() static factory
- Pass client_ip_ipv6 in devicehost options (not yet parsed by devicehost)
- Remove gateway_ip from devicehost options (only needed for DHCP)
- Include IPv6 DNS servers in non-tunneling DNS settings
- Add ConfigurationV6 and DnsResolutionAAAA tests

* cleanup and add more ipv6 tests

* added test coverage and minor updates

* clang format

* pr feedback

* format source

* pr feedback

* test fixes

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Track `bind` syscall when port is 0 (microsoft#14333)

* Initial work

* .

* pr feedback and add unit test

* minor tweaks an fix use after free in logging statement

* implement PR feedback

* hopefully final pr feedback

* pr feedback in test function

* Address PR feedback: add try/catch to TrackPort and PortZeroBind queue push

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Add iptables to list of apps to install in WSL (microsoft#14459)

There were instructions already on how to install tcpdump in WSL, but
iptables are also needed for the log collection to be complete, so this
PR adds instructions on how to also install iptables.

Co-authored-by: Andre Muezerie <andremue@linux.microsoft.com>

* Update Microsoft.WSL.DeviceHost to version 1.1.39-0 (microsoft#14460)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Moves all Ubuntu distros to the tar-based format (microsoft#14463)

* Move all supported Ubuntu images to the new format

We backported the build pipeline so all current LTSes come out in the new tar-based format

* Remove the appx based distros

All WSL users can run tar-based distros by now, right?
There is no benefit in maintaining both formats.

* Enable DNS tunneling for VirtioProxy networking mode (microsoft#14461)

- Allow VirtioProxy to keep EnableDnsTunneling=true in config, but clear
  socket-specific options (BestEffortDnsParsing, DnsTunnelingIpAddress)
- Suppress dedicated DNS tunneling hvsocket for VirtioProxy; tunneling
  is handled through the VirtioNetworking device host instead
- Set DnsTunneling flag on VirtioNetworkingFlags so the device host
  knows to tunnel DNS
- Expand SWIOTLB kernel cmdline to cover VirtioFs and VirtioProxy
- Bump DeviceHost package to 1.1.39-0
- Add VirtioProxy DNS test coverage for tunneling on/off
- Skip GuestPortIsReleasedV6 on Windows 10

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* test: disable LoopbackExplicit due to OS build 29555 regression (microsoft#14477)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Refactor: trim unnecessary DLL deps from COMMON_LINK_LIBRARIES (microsoft#14426)

* Refactor: trim unnecessary DLL deps from COMMON_LINK_LIBRARIES

- Split MSI/Wintrust install functions from wslutil.cpp into install.cpp
- Remove MI.lib, wsldeps.lib, msi.lib, Wintrust.lib, computecore.lib,
  computenetwork.lib, Iphlpapi.lib from COMMON_LINK_LIBRARIES
- Add per-target MSI_LINK_LIBRARIES, HCS_LINK_LIBRARIES, SERVICE_LINK_LIBRARIES
- Delay-load msi.dll and WINTRUST.dll for wsl.exe and wslg.exe
- Result: wslhost, wslrelay, wslcsdk, testplugin lose msi/wintrust startup imports;
  wsl.exe and wslg.exe defer msi/wintrust loading until actually needed;
  wslservice is the only target that imports computecore/computenetwork/Iphlpapi

* minor fixes to install.cpp that were caught during PR

* move to wsl::windows::common::install namespace

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Fix wsl stuck when misconfigured cifs mount presents (microsoft#14466)

* detach terminal before running mount -a

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* use _exit on error before execv in child process to avoid unintentional resource release

* Add regression test

* Fix clang format issue

* fix all clang format issue

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* resolve ai comments

* move test to unit test

* Fix string literal

* Overwrite fstab to resolve pipeline missing file issue

---------

Co-authored-by: Feng Wang <wangfen@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update localization and notice scripts to target the branch that the pipeline is running on (microsoft#14492)

* test: Add arm64 test distro support (microsoft#14500)

* test: Add arm64 test distro support

* update unit test baseline

* more test baseline updates

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* test: remove duplicated DNS test coverage (microsoft#14522)

* test: remove duplicated DNS test coverage

* format source

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* Fix: Fail and warn the user when --uninstall is given parameters (microsoft#14524)

Fail and warn the user when --uninstall is given parameters.

* Localization change from build: 142847827 (microsoft#14525)

Co-authored-by: WSL localization <noreply@microsoft.com>

* virito net: revert to previous DNS behavior while we debug an issue with DNS over TCP (microsoft#14532)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* devicehost: update to latest devicehost nuget with tracing improvements (microsoft#14531)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

* fix merge issues

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: AlmaLinux Autobot <107999298+almalinuxautobot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Blue <OneBlue@users.noreply.github.com>
Co-authored-by: WSL notice <noreply@microsoft.com>
Co-authored-by: Daman Mulye <daman_mulye@hotmail.com>
Co-authored-by: Andre Muezerie <108841174+andremueiot@users.noreply.github.com>
Co-authored-by: Andre Muezerie <andremue@linux.microsoft.com>
Co-authored-by: Carlos Nihelton <carlos.santanadeoliveira@canonical.com>
Co-authored-by: Feng Wang <wang6922@outlook.com>
Co-authored-by: Feng Wang <wangfen@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
* Added entrypoint

* Enhance tests
…osoft#14486)

* Save state

* Add test coverage

* Check the event under the lock

* Apply PR feedback

* Format

* Apply PR feedback
…oft#14549)

* Save state

* Save state

* Handle issues during pull

* Disable the pull tests

* Update the CLI tests

* Format

* Fix legacy index logic

* Add test coverage for failed PullImage()

* Update test/windows/WSLCTests.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…PI limit (microsoft#14561)

* Use pre-imported container images in the tests to avoid hitting the API limit

* Fix test case

* Update test/windows/wslc/e2e/WSLCE2EImageBuildTests.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Correctly set FileOffsets in WriteHandle

* Apply PR suggestions
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
…ove (microsoft#14429)

Allow clients to continue reading stdout/stderr and querying state from containers after they've been deleted, by caching the read-only data in the com wrapper.
…icrosoft#14482)

* Use Docker's FinishedAt timestamp in Transition() to fix StateChangedAt mismatch during container recovery

* Extract GetDockerFinishedAt() helper

* Address Feedback

* Fail if Docker event time is missing

* Address copilot feedback

* Use Docker stop event timestamp instead of InspectContainer()

* Apply copilot feedback

* PR Feedback
Add WSLC SDK Config.cmake file. Enable developers to consume the library with CMake.
…rosoft#14546)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
…oft#14566)

Build.SourceBranchName only returns the last segment after '/', breaking
branches with slashes (e.g. user/benhill/loc_fix -> loc_fix). Use
Build.SourceBranch with refs/heads/ stripped instead.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
WSLCDeleteImageFlagsForce (from WSLCDeleteImageFlags enum) was used instead
of WSLCDeleteFlagsForce (from WSLCDeleteFlags enum). Both values are currently
1, so no functional issue today, but this is a type confusion that will break
silently if either enum changes.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
)

std::stoul returns unsigned long (32-bit on Windows), truncating Content-Length
values >4GB. This corrupts the socket stream for large image save/export
operations.

Replace with std::stoull to parse as 64-bit unsigned.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
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 20 out of 20 changed files in this pull request and generated 3 comments.

Comment thread src/windows/wslcsession/WSLCVolumes.cpp Outdated
Comment thread src/windows/wslcsession/WSLCVolumes.cpp
Comment thread src/windows/wslcsession/DockerEventTracker.h
kvega005 and others added 2 commits May 1, 2026 10:39
Copilot AI review requested due to automatic review settings May 1, 2026 17:43
@kvega005 kvega005 marked this pull request as ready for review May 1, 2026 17:43
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 20 out of 20 changed files in this pull request and generated 1 comment.

Comment thread src/windows/wslcsession/WSLCProcessControl.cpp
kvega005 and others added 3 commits May 1, 2026 11:05
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings May 1, 2026 18: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

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

@kvega005 kvega005 assigned kvega005 and unassigned kvega005 May 1, 2026
@kvega005 kvega005 requested a review from a team May 1, 2026 19:22
Copy link
Copy Markdown
Collaborator

@OneBlue OneBlue left a comment

Choose a reason for hiding this comment

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

LGTM, one minor synchronization comment

Comment thread src/windows/wslcsession/WSLCVolumes.cpp
kvega005 and others added 2 commits May 5, 2026 13:41
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 17:48
@kvega005 kvega005 requested a review from a team May 7, 2026 00:06
Copy link
Copy Markdown
Collaborator

@OneBlue OneBlue left a comment

Choose a reason for hiding this comment

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

LGTM

@kvega005 kvega005 merged commit 2bd9656 into microsoft:master May 7, 2026
9 checks passed
@kvega005 kvega005 deleted the WslcVolumesManager branch May 7, 2026 16:17
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.