Skip to content

feat(vz): add DiskImageServer for NBD exports - #279

Merged
Code-Hex merged 2 commits into
mainfrom
codex/diskimage-server
Oct 27, 2026
Merged

Code-Hex merged 2 commits into
mainfrom
codex/diskimage-server

Conversation

@Code-Hex

@Code-Hex Code-Hex commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Why

Expose a diskimagekit image or stack over NBD, with a server URL that callers can pass to NewNetworkBlockDeviceStorageDeviceAttachment. Attachment creation stays with the caller, including the timeout, read-only setting, and synchronization mode.

This follows up on #224 and supersedes the native attachment wrapper in #276. It builds on #277, which added RAW/ASIF images and stacks in Go, and #278, which added the internal NBD server.

After considering Homebrew and other distribution methods, I chose to handle images in Go and connect them to Virtualization.framework over NBD. Applications can use images and stacks without compiling or distributing a separate Swift bridge. The VM accesses them through VZNetworkBlockDeviceStorageDeviceAttachment.

Scope

  • Add NewDiskImageServer, URL, and Close. The server uses a Unix socket in a private temporary directory by default.
  • Add WithDiskImageServerListener for a caller-supplied listener and server URL.
  • Keep ownership of the image with the caller. After the VM stops, Close disconnects clients, waits for image operations, and removes the temporary socket directory. The caller then closes the image.
  • Document the lifetime contract and cover listener ownership, connection cleanup, concurrent shutdown, and listener errors in tests.

@Code-Hex Code-Hex linked an issue Oct 27, 2026 that may be closed by this pull request
@Code-Hex
Code-Hex merged commit 81192cd into main Oct 27, 2026
12 of 13 checks passed
@Code-Hex
Code-Hex deleted the codex/diskimage-server branch October 27, 2026 11:57
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.

Support for DiskImageKit and the new stacked image features

1 participant