Skip to content

Commit f40a742

Browse files
committed
Set MTU on nmstate bridge ports
Propagate the bridge MTU to its physical ports when using the nmstate network engine. Closes-Bug: #2164513 Change-Id: I05d3f386157b887d5f550104fef7c5e7ffeed923 Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com> (cherry picked from commit 4ac2b42)
1 parent bda9c61 commit f40a742

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

kayobe/plugins/filter/nmstate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ def get_iface(name):
519519
# <network>_port_type_<portname>.
520520
for port in br_ports or []:
521521
port_iface = get_iface(port)
522+
if mtu:
523+
port_iface.setdefault("mtu", mtu)
522524
if "type" not in port_iface:
523525
# Check for explicit type configuration
524526
port_type = networks.net_attr(

kayobe/tests/unit/plugins/filter/test_nmstate.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class TestNMStateFilter(unittest.TestCase):
4444
"net3_interface": "br0",
4545
"net3_bridge_ports": ['eth1'],
4646
"net3_bridge_stp": True,
47+
"net3_mtu": 9000,
4748
# net4: bond on bond0 with slaves eth2 and eth3.
4849
"net4_interface": "bond0",
4950
"net4_bond_slaves": ['eth2', 'eth3'],
@@ -123,13 +124,15 @@ def test_nmstate_config_bridge(self):
123124
result = nmstate.nmstate_config(self.context, ["net3"])
124125
br_iface = next(i for i in result["interfaces"] if i["name"] == "br0")
125126
self.assertEqual(br_iface["type"], "linux-bridge")
127+
self.assertEqual(br_iface["mtu"], 9000)
126128
self.assertEqual(br_iface["bridge"]["port"], [{"name": "eth1"}])
127129
self.assertTrue(br_iface["bridge"]["options"]["stp"]["enabled"])
128130

129131
# eth1 should be present as ethernet
130132
eth1_iface = next(i for i in result["interfaces"]
131133
if i["name"] == "eth1")
132134
self.assertEqual(eth1_iface["type"], "ethernet")
135+
self.assertEqual(eth1_iface["mtu"], 9000)
133136

134137
def test_nmstate_config_bond(self):
135138
result = nmstate.nmstate_config(self.context, ["net4"])

0 commit comments

Comments
 (0)