Repository navigation
feat(hyperv): add Hyper-V backend and Windows host support - #173
Open
thejoeejoee wants to merge 3 commits into
Open
thejoeejoee wants to merge 3 commits into
thejoeejoee wants to merge 3 commits into
Conversation
Contributor
Author
Remaining Phase 5 Scope, Architectural Gaps & Open QuestionsThis PR lands Phases 1–4 of #2 (Windows host compatibility & preflight, pure-Go Below is a summary of what remains for Phase 5 (end-to-end runtime & CI) along with open design questions for maintainers. 1. Remaining Gaps (Phase 5)
2. Open Questions for Maintainers
|
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phases 1–4 of #2 to add a Windows Hyper-V HCS v2 backend and cross-platform Windows host support:
syscall.Stat_t,Setsid, process-group signaling, andO_NOFOLLOWcalls acrossinternal/pathutil,internal/procutil,extract,rootfs,image,hooks,runner, and root options into platform-specific files.preflight/hyperv_windows.goandpreflight/resources_windows.goverifyingvmcompute.dll(HcsEnumerateComputeSystems), disk space (GetDiskFreeSpaceEx), CPU, and memory (GlobalMemoryStatusEx).defaultBackend()split (default_backend_unix.go->libkrun.NewBackend(),default_backend_windows.go->hyperv.NewBackend()).image/vhd):image/vhd.BuildFromDirusinggithub.com/Microsoft/hcsshim/ext4/tar2ext4(ConvertWhiteout,AppendVhdFooter,MaximumDiskSize) to stream a prepared rootfs directory into an ext4 image with a fixed VHD footer without host disk mounting or CGO.user.containers.override_statmetadata when present and restores executable bits on standard binary paths when extracted on Windows NTFS.hypervisor/hyperv):hypervisor.Backendandhypervisor.VMHandleinhypervisor/hyperv.hypervisor.VMConfiginto an HCS Schema v2.1ComputeSystemdocument (LinuxKernelDirect, SCSI controller 0 with LUN 0 rootfs VHD + extraDisks,Plan9shares forFilesystemMounts, andHvSocketservice table configuration).vmcompute.dllon Windows (HcsCreateComputeSystem,HcsStartComputeSystem,HcsShutdownComputeSystem,HcsTerminateComputeSystem,HcsGetComputeSystemProperties,HcsCloseComputeSystem) with async callback notification handling behind an injectableRunnerinterface.AF_HYPERVnetworking, guest9pmounts, and guesthv_sock↔eth0TAP relay:net/hosted.ProviderwithEndpoint()(net.EndpointProvider), injectable listener factories, and Windowshvsock(AF_HYPERV) support feedingvn.AcceptQemu.9p(trans=virtio,version=9p2000.L,msize=524288) mount support inguest/mountandguest/vmconfig.guest/netcfg.BridgeStreamToPacketandStartHVSocketTAPto bridge guestAF_VSOCKstreams to a Linuxeth0TAP interface usinggvisor-tap-vsock's 4-byte big-endian length-prefixed Ethernet frame protocol.Closes #2
Verification
CGO_ENABLED=0 go test ./...(excludingkrunandgo-microvm-runner) on Linux, including end-to-end ARP round-trip tests throughBridgeStreamToPacket+virtualnetwork.AcceptQemuand ext4 superblock/VHD footer verificationGOOS=windows GOARCH=amd64 CGO_ENABLED=0 go buildacross all non-CGO packagesgolangci-lint runonGOOS=linux,GOOS=darwin, andGOOS=windows