refactor(vmm): remove built-in port forwarding#795
Merged
Conversation
Signed-off-by: Kevin Wang <wy721@qq.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the VMM’s bridge-mode userspace port-forwarding subsystem (and its supporting DHCP lease reporting/state), leaving QEMU user-mode networking and its port_map/hostfwd behavior unchanged. It simplifies bridge-mode setup to use dnsmasq solely for DHCP address assignment and updates config/templates/docs accordingly.
Changes:
- Remove the built-in bridge forwarding service, DHCP lease report RPC, and persisted
guest-ip/forwarding state fromdstack-vmm. - Remove the
dstack-port-forwardworkspace crate and all references/dependencies. - Update bridge networking scripts/docs and reserve the removed protobuf field name/number.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dstack/vmm/vmm.toml | Removes the bridge forwarding config flag from the sample config. |
| dstack/vmm/src/main_service.rs | Drops DHCP lease RPC handling and forwarding reconfiguration hooks. |
| dstack/vmm/src/config.rs | Removes forward_service_enabled from the Networking config struct. |
| dstack/vmm/src/app/workdir.rs | Removes persisted guest-ip file helpers. |
| dstack/vmm/src/app/network.rs | Removes forwarding-related validation constraint for multiple bridges. |
| dstack/vmm/src/app.rs | Removes port-forward service state, DHCP lease handling, and forwarding lifecycle logic. |
| dstack/vmm/rpc/proto/vmm_rpc.proto | Removes ReportDhcpLease and reserves the forward_service_enabled field number/name. |
| dstack/vmm/Cargo.toml | Drops dependency on dstack-port-forward. |
| dstack/test-scripts/snp-e2e-smoke.sh | Removes the forwarder flag from embedded config snippets. |
| dstack/scripts/setup-bridge.sh | Removes DHCP notification checks/installation; dnsmasq config no longer uses dhcp-script. |
| dstack/scripts/dhcp-notify.sh (removed) | Deletes the dnsmasq lease notification script (no longer needed). |
| dstack/port-forward/src/udp.rs (removed) | Removes UDP forwarder implementation. |
| dstack/port-forward/src/tcp.rs (removed) | Removes TCP forwarder implementation. |
| dstack/port-forward/src/lib.rs (removed) | Removes forward-service rule management API. |
| dstack/port-forward/Cargo.toml (removed) | Removes the port-forward crate manifest. |
| dstack/crates/dstack-cli-core/src/config.rs | Updates CLI core config template to remove the forwarder flag. |
| dstack/Cargo.toml | Removes port-forward from workspace members and workspace dependencies. |
| dstack/Cargo.lock | Lockfile updates reflecting removed crate/dependencies. |
| docs/bridge-networking.md | Updates bridge networking docs to remove DHCP notify/forwarding references. |
Comments suppressed due to low confidence (2)
dstack/vmm/src/app.rs:1404
- If
Networking::forward_service_enabledis kept as a deprecated/ignored field for backward-compatible deserialization, this test initializer also needs to set it (e.g.,false) to keep the struct literal compiling.
manifest.networks = vec![Networking {
mode: NetworkingMode::Bridge,
bridge: "dstack-br0".to_string(),
mac_prefix: String::new(),
net: String::new(),
dhcp_start: String::new(),
restrict: false,
netdev: String::new(),
}];
dstack/vmm/src/app.rs:1618
- If
Networking::forward_service_enabledis kept as a deprecated/ignored field for backward-compatible deserialization, this test initializer also needs to set it (e.g.,false) to keep the struct literal compiling.
bridge_manifest.networks = vec![Networking {
mode: NetworkingMode::Bridge,
bridge: "dstack-br0".to_string(),
mac_prefix: "02:aa:bb".to_string(),
net: String::new(),
dhcp_start: String::new(),
restrict: false,
netdev: String::new(),
}];
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
ReportDhcpLease, persistedguest-ipstate, and DHCP notification setupQEMU user-mode networking and its explicit
port_mapsupport are unchanged.This follows the removal direction discussed in #756 (comment). The built-in bridge forwarder depended on an out-of-band DHCP lease report whose state could be stale and was not useful outside this subsystem.
Testing
cargo test --manifest-path dstack/Cargo.toml -p dstack-vmmcargo test --manifest-path dstack/Cargo.toml -p dstack-cli-corecargo check --manifest-path dstack/Cargo.toml --workspacebash -n dstack/scripts/setup-bridge.sh