Force bonds/vlans re-parsing when lower layer changes#5902
Open
milan-zededa wants to merge 1 commit intolf-edge:masterfrom
Open
Force bonds/vlans re-parsing when lower layer changes#5902milan-zededa wants to merge 1 commit intolf-edge:masterfrom
milan-zededa wants to merge 1 commit intolf-edge:masterfrom
Conversation
0fefc61 to
ff75f7b
Compare
parseBonds and parseVlans each use a content hash to skip parsing when their own config is unchanged. However, both store pointers to lower-layer objects (physio pointers in bond.lowerPhysPorts, bond pointers in vlan.lowerL2Ports) obtained at parse time. If a lower layer is parsed without the dependent layer being parsed, those pointers become stale (pointing at parsed old config). Fix by propagating force-parse down the dependency chain: - parseBonds is forced to parse when physio changes - parseVlans is forced to parse when physio or bonds change Signed-off-by: Milan Lenco <milan@zededa.com>
ff75f7b to
15aceeb
Compare
eriknordmark
approved these changes
May 5, 2026
Contributor
eriknordmark
left a comment
There was a problem hiding this comment.
Run tests. Some yetus issues to fix.
Contributor
Author
Those yetus issues shown are for unchanged lines. In fact, the Yetus check is green, so this is some github/yetus/workflow fail. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5902 +/- ##
==========================================
- Coverage 19.52% 17.11% -2.42%
==========================================
Files 19 474 +455
Lines 3021 85692 +82671
==========================================
+ Hits 590 14662 +14072
- Misses 2310 69514 +67204
- Partials 121 1516 +1395 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
parseBondsandparseVlanseach use a content hash to skip parsing when their own config is unchanged. However, both store pointers to lower-layer objects (physio pointers inbond.lowerPhysPorts, bond pointers invlan.lowerL2Ports) obtained at parse time. If a lower layer is parsed without the dependent layer being parsed, those pointers become stale (pointing at parsed old config).Fix by propagating force-parse down the dependency chain:
parseBondsis forced to parse when physio changesparseVlansis forced to parse when physio or bonds changeHow to test and validate this PR
Set up a device with four network adapters (e.g.
eth0–eth3) and configure two bonds with VLAN sub-interfaces on top:Initial config
bond1: aggregateseth0,eth1— management uplink (DHCP)bond2: aggregateseth2,eth3vlan20,vlan21: parent portbond2Apply this config and confirm the device connects and reports no port errors.
Config change — swap
eth1andeth2between the bondsbond1: aggregateseth0,eth2bond2: aggregateseth1,eth3Expected (correct) result
/run/zedagent/DevicePortConfig/zedagent.jsonshould show:bond1.Bond.AggregatedPorts = ["eth0", "eth2"]bond2.Bond.AggregatedPorts = ["eth1", "eth3"]LastErroron any portRegression (what the bug produced)
Without the fix, parsed VLAN config would remain stale from a prior parse and
zedagent.jsoncould showeth2under bothbond1andbond2, resulting in:Changelog notes
Fixed a bug where re-configuring bond membership (e.g. swapping physical interfaces between two bonds) could leave the device with a broken network configuration and a
port aggregated by multiple bondserror, requiring a reboot to recover.Checklist