Repository navigation
feat(vz): add DiskImageServer for NBD exports - #279
Merged
Merged
Conversation
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.
Why
Expose a
diskimagekitimage or stack over NBD, with a server URL that callers can pass toNewNetworkBlockDeviceStorageDeviceAttachment. 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
NewDiskImageServer,URL, andClose. The server uses a Unix socket in a private temporary directory by default.WithDiskImageServerListenerfor a caller-supplied listener and server URL.Closedisconnects clients, waits for image operations, and removes the temporary socket directory. The caller then closes the image.