[Bug 256309] net/cloud-init: fix set mtu (work in progress)
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 256309] net/cloud-init: fix set mtu (work in progress)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 256309] net/cloud-init: fix set mtu (work in progress)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 256309] net/cloud-init: fix set mtu (work in progress)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 256309] net/cloud-init: fix set mtu, bump port version 21.2"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 256309] net/cloud-init: fix set mtu, bump port version 21.2"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 31 May 2021 19:40:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256309
Bug ID: 256309
Summary: net/cloud-init: fix set mtu (work in progress)
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: ports-bugs@FreeBSD.org
Reporter: andrey@bsdnir.info
Upstream have patch https://github.com/canonical/cloud-init/pull/894/files
but, this add set mtu only "subnets:" section, docs and may by some dadasource
(SmartOS) support only set mtu in "config:" section, linux's have any with
subnets priority
`netplan.py[WARNING]: Network config: ignoring enp0s5 device-level mtu:1500
because ipv4 subnet-level mtu:1501 provided.`
proof of concept get data in config section, but linux have logic
https://github.com/canonical/cloud-init/blob/master/cloudinit/net/netplan.py#L116
(line 134)
https://github.com/canonical/cloud-init/blob/master/cloudinit/net/eni.py#L107
```
--- /usr/local/lib/python3.8/site-packages/cloudinit/net/bsd.py.orig
2021-01-15 17:33:05.000000000 +0000
+++ /usr/local/lib/python3.8/site-packages/cloudinit/net/bsd.py 2021-05-31
19:30:55.808268000 +0000
@@ -37,7 +37,9 @@ class BSDRenderer(renderer.Renderer):
ifname_by_mac = net.get_interfaces_by_mac()
for interface in settings.iter_interfaces():
device_name = interface.get("name")
+ device_mtu = interface.get("mtu")
device_mac = interface.get("mac_address")
+ LOG.info('Debug interface mtu %s', device_mtu)
if device_name and re.match(r'^lo\d+$', device_name):
continue
if device_mac not in ifname_by_mac:
@@ -64,18 +66,21 @@ class BSDRenderer(renderer.Renderer):
for subnet in interface.get("subnets", []):
if subnet.get('type') == 'static':
+ LOG.debug('Debug mtu %s', subnet.get('mtu'))
+ LOG.debug('Debug address %s', subnet.get('address'))
if not subnet.get('netmask'):
LOG.debug(
'Skipping IP %s, because there is no netmask',
subnet.get('address')
)
continue
- LOG.debug('Configuring dev %s with %s / %s', device_name,
- subnet.get('address'), subnet.get('netmask'))
+ LOG.debug('Configuring dev %s with %s / %s mtu %s, device
mtu %s', device_name,
+ subnet.get('address'), subnet.get('netmask'),
subnet.get('mtu'), device_mtu)
self.interface_configurations[device_name] = {
'address': subnet.get('address'),
'netmask': subnet.get('netmask'),
+ 'mtu': device_mtu,
}
def _route_entries(self, settings, target=None):
--- /usr/local/lib/python3.8/site-packages/cloudinit/net/freebsd.py.orig
2021-01-15 17:33:05.000000000 +0000
+++ /usr/local/lib/python3.8/site-packages/cloudinit/net/freebsd.py
2021-05-31 19:31:29.486255000 +0000
@@ -19,12 +19,13 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
def write_config(self):
for device_name, v in self.interface_configurations.items():
+ net_config = 'DHCP'
if isinstance(v, dict):
- self.set_rc_config_value(
- 'ifconfig_' + device_name,
- v.get('address') + ' netmask ' + v.get('netmask'))
- else:
- self.set_rc_config_value('ifconfig_' + device_name, 'DHCP')
+ net_config = v.get('address') + ' netmask ' + v.get('netmask')
+ mtu = v.get('mtu')
+ if mtu:
+ net_config += (' mtu %d' % mtu)
+ self.set_rc_config_value('ifconfig_' + device_name, net_config)
def start_services(self, run=False):
if not run:
```
DataSourceSmartOS declare only physical section contain mtu
https://github.com/canonical/cloud-init/blob/master/cloudinit/sources/DataSourceSmartOS.py#L815
--
You are receiving this mail because:
You are the assignee for the bug.