-
Notifications
You must be signed in to change notification settings - Fork 93
feat(vmm): add netd-managed macvtap networking #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0cbefa4
feat(vmm): add netd-managed macvtap networking
kvinwang 2e0f44a
refactor(vmm): remove unused QEMU user setting
kvinwang 012d895
refactor(vmm): separate macvtap prepare RPC
kvinwang 7d34414
feat(vmm): exec single-process launches in place
kvinwang a0272eb
refactor(vmm): avoid implicit launcher panic paths
kvinwang 97b9216
refactor(vmm): use safe effective ID wrappers
kvinwang abc4e53
refactor(vmm): minimize launcher unsafe calls
kvinwang c943fa6
refactor(vmm): name bridge preparation explicitly
kvinwang 15c9556
fix(vmm): launch with prepared macvtap devices
kvinwang ded3e54
fix(vmm): preserve single-process exec launch
kvinwang cebc153
fix(vmm): avoid persisting macvtap device paths
kvinwang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Macvtap networking | ||
|
|
||
| Macvtap mode gives each CVM a layer-2 identity on an existing host network | ||
| without adding the parent interface to a Linux bridge. The VMM delegates the | ||
| privileged interface lifecycle to `dstack-vmm netd`; manifests never contain | ||
| the unstable `/dev/tapN` device path. | ||
|
|
||
| ## Configuration | ||
|
|
||
| Configure a NIC through the manifest or VMM RPC: | ||
|
|
||
| ```json | ||
| { | ||
| "mode": "macvtap", | ||
| "parent": "eth0", | ||
| "macvtap_mode": "private" | ||
| } | ||
| ``` | ||
|
|
||
| `parent` must name an existing host interface. `macvtap_mode` may be | ||
| `private`, `bridge`, `vepa`, or `passthru`; an empty value selects `private`. | ||
| The configured netd socket and caller allowlist apply in the same way as for | ||
| libvirt-filtered bridge networking. | ||
|
|
||
| ## Lifecycle | ||
|
|
||
| For every macvtap NIC, the VMM sends netd the VM identity, NIC index, parent, | ||
| and the same deterministic MAC address passed to QEMU. Netd then: | ||
|
|
||
| 1. derives the stable `dt<hash>` interface name; | ||
| 2. replaces any stale interface with that name; | ||
| 3. creates and activates the macvtap interface; | ||
| 4. reads its kernel-assigned ifindex and waits for `/dev/tap<ifindex>`; and | ||
| 5. returns that runtime device path to the VMM. | ||
|
|
||
| The per-VM launcher opens the character device, places it at the fd referenced | ||
| by QEMU's `-netdev tap,fd=...` argument, and then execs QEMU. This keeps device | ||
| paths out of persistent VM | ||
| configuration, works with both Supervisor and systemd process managers, and | ||
| does not pass network fds through `sudo`. | ||
|
|
||
| VM shutdown removes the interface by its deterministic identity. The device | ||
| node disappears with the interface; its numeric path is never reused as an | ||
| identity or cleanup key. | ||
|
|
||
| ## Limitations | ||
|
|
||
| - The host and a macvtap guest do not communicate directly through the parent | ||
| interface by default. Add a host macvlan/macvtap endpoint if that path is | ||
| required. | ||
| - Libvirt nwfilter bindings apply only to bridge mode. Macvtap deployments | ||
| must enforce network policy in the physical network or with another host | ||
| mechanism. | ||
| - Real-host testing requires `CAP_NET_ADMIN`, a working udev setup for | ||
| `/dev/tapN`, and an upstream network that accepts multiple MAC addresses. | ||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.