net: render multi-word bond options in the NetworkManager keyfile#6936
Open
tushardev-365 wants to merge 1 commit into
Open
net: render multi-word bond options in the NetworkManager keyfile#6936tushardev-365 wants to merge 1 commit into
tushardev-365 wants to merge 1 commit into
Conversation
holmanb
requested changes
Jul 17, 2026
holmanb
left a comment
Member
There was a problem hiding this comment.
Thanks for this proposal. I left a couple of requests.
Comment on lines
+266
to
+302
| config = textwrap.dedent( | ||
| """\ | ||
| config = textwrap.dedent("""\ |
Member
There was a problem hiding this comment.
Please avoid unnecessary whitespace changes. Same comment below.
|
|
||
| def test_subnet_route_metric(self, tmpdir): | ||
| """Test subnet metric renders as route-metric in NM config.""" | ||
| config = textwrap.dedent( |
Member
There was a problem hiding this comment.
Please avoid unnecessary whitespace changes.
Comment on lines
+296
to
+299
| assert "fail_over_mac=active" in bond_conf | ||
| assert "primary_reselect=always" in bond_conf | ||
| assert "xmit_hash_policy=layer3+4" in bond_conf | ||
|
|
Member
There was a problem hiding this comment.
Please update this to use the config / expected_config style of the test above. Checking a couple of keys is okay, but I think it is better to assert the final output.
The NetworkManager renderer looked up bond options in _prop_map using underscore-separated keys (bond-fail_over_mac). v1 network config uses that spelling, but v2-derived config produces dash-separated internal keys (bond-fail-over-mac), so multi-word options such as fail-over-mac-policy, primary-reselect-policy and transmit-hash-policy missed the lookup and were silently dropped from the rendered bond. Accept both spellings when looking up the option, mirroring the sysconfig and eni renderers which already tolerate dash or underscore. Fixes canonicalGH-6932 Signed-off-by: Tushar Pagar <240662211+tushardev-365@users.noreply.github.com>
tushardev-365
force-pushed
the
fix/nm-bond-multiword-options
branch
from
July 17, 2026 18:32
4128abb to
f5ab6d3
Compare
Author
|
Thanks for the review. Addressed both points:
Full suite passes; ruff and black (25.1.0) are clean. |
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.
Fixes GH-6932.
The NetworkManager renderer looks up bond options in
_prop_mapusing underscore-separated keys (bond-fail_over_mac). v1 network config uses that spelling, but v2-derived config produces dash-separated internal keys (bond-fail-over-mac), so multi-word options likefail-over-mac-policy,primary-reselect-policyandtransmit-hash-policymissed the lookup and were silently dropped from the rendered bond, with no error or warning. Single-token options (mode, miimon, primary, up-delay...) were unaffected, which is why this went unnoticed.The fix accepts both spellings when looking up the option, mirroring what the sysconfig renderer already does (
bond_keys = [bond_key, bond_key.replace("_", "-")]) and what eni/netplan do with.replace("_", "-"). The NM renderer was the only bond renderer not tolerating both.Testing
test_bond_multiword_options_from_v2, which renders a v2 bond withfail-over-mac-policy,primary-reselect-policyandtransmit-hash-policyand asserts they reach thebond0.nmconnectionkeyfile. It fails onmain(options dropped) and passes with this change.test_network_manager.pysuite (7 tests) stays green.ruffandblackclean on both files.