Allow setting mtu and mac addr on bonds in NetworkManager

Signed-off-by: Tim Weiers <56134890+tweiers@users.noreply.github.com>
Co-authored-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Tim Weiers
2025-09-19 18:38:28 +00:00
committed by Jonathon Anderson
parent a16d92f56e
commit 2b8d1be6b6
4 changed files with 299 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `wwclient.x86_64` overlay always provides an x86_64 wwclient executable.
- systemd-networkd overlay with IPv6 support
- `wwctl overlay info` lists the variables used by an overlay template
- Added support for setting mtu and mac address on bonds with NetworkManager #2059
### Changed

View File

@@ -403,6 +403,286 @@ mac-address=9a:77:29:73:14:f1
[ipv4]
method=disabled
[ipv6]
method=disabled
`,
},
"NetworkManager:ww4-managed.ww with ethernet bond and mtu": {
nodes_conf: `
nodes:
node1:
network devices:
bond0:
type: Bond
device: bond0
ipaddr: 192.168.3.110
netmask: 255.255.255.0
mtu: 9000
hwaddr: 9a:77:29:73:14:f1
tags:
type: ethernet
eth0:
device: eth0
type: ethernet
tags:
master: bond0
eth1:
device: eth1
type: ethernet
tags:
master: bond0
`,
args: []string{"--render", "node1", "NetworkManager", "etc/NetworkManager/system-connections/ww4-managed.ww"},
log: `backupFile: true
writeFile: true
Filename: warewulf-bond0.conf
# This file is autogenerated by warewulf
[connection]
id=bond0
interface-name=bond0
type=bond
autoconnect=true
[bond]
downdelay=0
miimon=100
mode=balance-rr
xmit_hash_policy=layer2+3
updelay=0
[ethernet]
mac-address=9a:77:29:73:14:f1
mtu=9000
[ipv4]
method=manual
address=192.168.3.110/24
[ipv6]
addr-gen-mode=eui64
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-eth0.conf
# This file is autogenerated by warewulf
[connection]
id=eth0
interface-name=eth0
type=ethernet
master=bond0
slave-type=bond
autoconnect=true
[ethernet]
[ipv4]
method=disabled
[ipv6]
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-eth1.conf
# This file is autogenerated by warewulf
[connection]
id=eth1
interface-name=eth1
type=ethernet
master=bond0
slave-type=bond
autoconnect=true
[ethernet]
[ipv4]
method=disabled
[ipv6]
method=disabled
`,
},
"NetworkManager:ww4-managed.ww with ethernet bond and cloned mac address": {
nodes_conf: `
nodes:
node1:
network devices:
bond0:
type: Bond
device: bond0
ipaddr: 192.168.3.110
netmask: 255.255.255.0
tags:
cloned-mac-address: 9a:77:29:73:14:f1
eth0:
device: eth0
type: ethernet
tags:
master: bond0
eth1:
device: eth1
type: ethernet
tags:
master: bond0
`,
args: []string{"--render", "node1", "NetworkManager", "etc/NetworkManager/system-connections/ww4-managed.ww"},
log: `backupFile: true
writeFile: true
Filename: warewulf-bond0.conf
# This file is autogenerated by warewulf
[connection]
id=bond0
interface-name=bond0
type=bond
autoconnect=true
[bond]
downdelay=0
miimon=100
mode=balance-rr
xmit_hash_policy=layer2+3
updelay=0
cloned-mac-address=9a:77:29:73:14:f1
[ipv4]
method=manual
address=192.168.3.110/24
[ipv6]
addr-gen-mode=eui64
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-eth0.conf
# This file is autogenerated by warewulf
[connection]
id=eth0
interface-name=eth0
type=ethernet
master=bond0
slave-type=bond
autoconnect=true
[ethernet]
[ipv4]
method=disabled
[ipv6]
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-eth1.conf
# This file is autogenerated by warewulf
[connection]
id=eth1
interface-name=eth1
type=ethernet
master=bond0
slave-type=bond
autoconnect=true
[ethernet]
[ipv4]
method=disabled
[ipv6]
method=disabled
`,
},
"NetworkManager:ww4-managed.ww with infiniband bond and mtu": {
nodes_conf: `
nodes:
node1:
network devices:
bond0:
type: Bond
device: bond0
ipaddr: 192.168.3.110
netmask: 255.255.255.0
mtu: 9000
hwaddr: 9a:77:29:73:14:f1
tags:
type: infiniband
ib0:
device: ib0
type: infiniband
tags:
master: bond0
ib1:
device: ib1
type: infiniband
tags:
master: bond0
`,
args: []string{"--render", "node1", "NetworkManager", "etc/NetworkManager/system-connections/ww4-managed.ww"},
log: `backupFile: true
writeFile: true
Filename: warewulf-bond0.conf
# This file is autogenerated by warewulf
[connection]
id=bond0
interface-name=bond0
type=bond
autoconnect=true
[bond]
downdelay=0
miimon=100
mode=balance-rr
xmit_hash_policy=layer2+3
updelay=0
[infiniband]
transport-mode=datagram
mtu=9000
[ipv4]
method=manual
address=192.168.3.110/24
[ipv6]
addr-gen-mode=eui64
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-ib0.conf
# This file is autogenerated by warewulf
[connection]
id=ib0
interface-name=ib0
type=infiniband
master=bond0
slave-type=bond
autoconnect=true
[infiniband]
transport-mode=datagram
[ipv4]
method=disabled
[ipv6]
method=disabled
backupFile: true
writeFile: true
Filename: warewulf-ib1.conf
# This file is autogenerated by warewulf
[connection]
id=ib1
interface-name=ib1
type=infiniband
master=bond0
slave-type=bond
autoconnect=true
[infiniband]
transport-mode=datagram
[ipv4]
method=disabled
[ipv6]
method=disabled
`,

View File

@@ -14,22 +14,27 @@ slave-type=bond
{{- end }}
autoconnect={{ $netdev.OnBoot.BoolDefaultTrue }}
{{- if eq (lower $netdev.Type) "bond" }}
{{- if or (eq (lower $netdev.Type) "bond") (eq (lower (default "" $netdev.Tags.type)) "bond") }}
[bond]
downdelay={{ default 0 $netdev.Tags.downdelay }}
miimon={{ default 100 $netdev.Tags.miimon }}
mode={{ default "balance-rr" $netdev.Tags.mode }}
xmit_hash_policy={{ default "layer2+3" $netdev.Tags.xmit_hash_policy }}
updelay={{ default 0 $netdev.Tags.updelay }}
{{- if index $netdev.Tags "cloned-mac-address" }}
cloned-mac-address={{ index $netdev.Tags "cloned-mac-address" }}
{{- end }}
{{- end }}
{{- if eq (lower $netdev.Type) "infiniband" }}
{{- if or (eq (lower $netdev.Type) "infiniband") (eq (lower (default "" $netdev.Tags.type)) "infiniband") }}
[infiniband]
transport-mode=datagram
{{- if $netdev.MTU }}
mtu={{ $netdev.MTU }}
{{- end }}
{{- else if eq (default "ethernet" (lower $netdev.Type)) "ethernet" }}
{{- end }}
{{- if or (eq (default "ethernet" (lower $netdev.Type)) "ethernet") (eq (lower (default "" $netdev.Tags.type)) "ethernet") }}
[ethernet]
{{- if $netdev.Hwaddr }}
mac-address={{ $netdev.Hwaddr }}
@@ -37,6 +42,9 @@ mac-address={{ $netdev.Hwaddr }}
{{- if $netdev.MTU }}
mtu={{ $netdev.MTU }}
{{- end }}
{{- if index $netdev.Tags "cloned-mac-address" }}
cloned-mac-address={{ index $netdev.Tags "cloned-mac-address" }}
{{- end }}
{{- end }}
[ipv4]

View File

@@ -288,10 +288,17 @@ customize the interface:
NetworkManager
^^^^^^^^^^^^^^
The NetworkManager overlay supports additional netdev tags for advanced
interface configuration:
- **parent_device:** the parent device of a vlan interface
- **vlan_id:** the vlan id for a vlan interface
- **downdelay, updelay, miimon, mode, xmit_hash_policy:**
bond device settings
- **type:** a secondary interface type, typically used to specify the bond type
(e.g., ``ethernet`` or ``infiniband``)
- **mtu:** specify the mtu for the interface
- **cloned-mac-address:** set a cloned MAC address for the interface
Basics
------