fix(vm): stabilize the order of network interfaces#2001
Open
LopatinDmitr wants to merge 1 commit intomainfrom
Open
fix(vm): stabilize the order of network interfaces#2001LopatinDmitr wants to merge 1 commit intomainfrom
LopatinDmitr wants to merge 1 commit intomainfrom
Conversation
3cb8cd3 to
b6626ac
Compare
f4cb252 to
690f777
Compare
Signed-off-by: Dmitry Lopatin <dmitry.lopatin@flant.com>
690f777 to
1dd9d76
Compare
prismagod
approved these changes
Feb 25, 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.
Description
This PR stabilize the order of network interfaces:
API: Add optional
idfield toNetworksSpecandNetworksStatusso each network entry has a stable identifier.Controller: Introduce
MacAddressPooland ID-based logic inCreateNetworkSpec: MACs are bound to network name (from status), so reusing the same spec entries (with same IDs) after removal preserves MACs and interface names. Allocate and persist network IDs in the reconciler; validators enforce that existing IDs are immutable and in range 1–16383.e2e: Add test “verifies interface name persistence after removing middle ClusterNetwork”: create VM with Main + two ClusterNetworks, record last interface name via SSH, remove the middle ClusterNetwork from spec (keeping first and third entries so IDs are preserved), reboot via VMOP, then assert the last interface name is unchanged.
Example spec before (Main + two ClusterNetworks):
After removing the middle network, user keeps the same structs for the remaining networks so IDs (and thus MACs/interface names) stay stable:
Why do we need it, and what problem does it solve?
When a VM has several additional networks (e.g. Main + two ClusterNetworks) and the user removes one of them from
spec.networks, the controller re-builds the interface list. Without stable IDs, the remaining networks could get new MAC addresses and thus new interface names inside the guest (e.g.eth2becomingeth1). That breaks guest-side configuration (scripts, Netplan, static IPs) and complicates automation.Checklist
Changelog entries