> I guess it's time for me to ask a question: is it cloud-init that
> renders /etc/netplan/50-cloud-init.yaml? If so where does netplan
> fit in when the difference is how that file is rendered and not
> how it is interpreted. As you can see in #10 the mtu statement is
> not in the file on bionic, while it is on focal.
>
> Since versions appear to be the same my guess would be that there
> is some internal modelling of how bionic vs. focal should be
> configured?
There isn't an internal model; cloud-init SRU's master back to
previous releases. For OpenStack, cloud-init on Xenial does not
render network-data.json by default as that's a behavior change
added in Bionic and newer.
The pipeline looks like:
cloudinit (fetch network-data.json from OpenStack)
`-> cloudinit (convert network-data.json to network-config-v1)
`-> cloudinit (converts network-config-v1 -> netplan on Ubuntu)
`-> cloudinit (calls netplan generate -> systemd-networkd files)
> I can't let go of why the same version of cloud-init renders
> different config with the same data source.
Are you sure the 'mtu' value it was present in the network-data.json
at the time cloud-init fetched it vs. when you curl later?
Ceck the cloud-init.log file; you should see the network
config after it was converted from network-data.json somewhere
in the log.
Give your JSON from [10], bionic and focal render this the same
## BIONIC ##
% lxc launch ubuntu-daily:bionic b1
% lxc exec b1 bash
root@b1:~# lsb_release -rd
Description: Ubuntu 18.04.5 LTS
Release: 18.04
root@b1:~# dpkg --list | egrep "(cloud-init|netplan)"
ii cloud-init 20.3-2-g371b392c-0ubuntu1~18.04.1 all
Init scripts for cloud instances
ii cloud-initramfs-copymods 0.40ubuntu1.1 all
copy initramfs modules into root filesystem for later use
ii cloud-initramfs-dyn-netconf 0.40ubuntu1.1 all
write a network interface file in /run for BOOTIF
ii libnetplan0:amd64 0.99-0ubuntu3~18.04.3 amd64
YAML network configuration abstraction runtime library
ii netplan.io 0.99-0ubuntu3~18.04.3 amd64
YAML network configuration abstraction for various backends
root@b1:~# cat /etc/cloud/build.info
build_name: server
serial: 20201014
root@b1:~# cat network-data.json
{"links": [{"id": "tapc352887e-0f", "vif_id":
"c352887e-0fff-481b-af47-7df9f7c2ff05", "type": "ovs", "mtu": 8950,
"ethernet_mac_address": "fa:16:3e:a3:34:78"}], "networks": [{"id": "network0",
"type": "ipv4_dhcp", "link": "tapc352887e-0f", "network_id":
"f8123ceb-e29d-4f4a-b200-6fb3bf3984ba"}], "services": []}
root@b1:~# cloud-init devel net-convert --network-data network-data.json -k
network_data.json -m "ens4,fa:16:3e:a3:34:78" -d test -D ubuntu --debug -O
netplan
2020-10-15 15:09:17,796 - util.py[DEBUG]: Reading from /proc/uptime
(quiet=False)
2020-10-15 15:09:17,797 - util.py[DEBUG]: Read 14 bytes from /proc/uptime
2020-10-15 15:09:17,797 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/addr_assign_type (quiet=False)
2020-10-15 15:09:17,797 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/eth0/addr_assign_type
2020-10-15 15:09:17,797 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/uevent (quiet=False)
2020-10-15 15:09:17,797 - util.py[DEBUG]: Read 26 bytes from
/sys/class/net/eth0/uevent
2020-10-15 15:09:17,797 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/address (quiet=False)
2020-10-15 15:09:17,797 - util.py[DEBUG]: Read 18 bytes from
/sys/class/net/eth0/address
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/device/device (quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from
/sys/class/net/lo/addr_assign_type (quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/lo/addr_assign_type
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent
(quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Read 23 bytes from
/sys/class/net/lo/uevent
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from
/sys/class/net/lo/address (quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Read 18 bytes from
/sys/class/net/lo/address
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from
/sys/class/net/lo/device/device (quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from /sys/class/net/eth0/type
(quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/eth0/type
2020-10-15 15:09:17,798 - util.py[DEBUG]: Reading from /sys/class/net/lo/type
(quiet=False)
2020-10-15 15:09:17,798 - util.py[DEBUG]: Read 4 bytes from
/sys/class/net/lo/type
Internal State
--- !!python/object:cloudinit.net.network_state.NetworkState
_has_default_route: null
_network_state:
config:
- mac_address: fa:16:3e:a3:34:78
mtu: 8950
name: ens4
subnets:
- type: dhcp4
type: physical
dns:
nameservers: []
search: []
interfaces:
ens4:
accept-ra: null
address: null
gateway: null
inet: inet
mac_address: fa:16:3e:a3:34:78
mode: manual
mtu: 8950
name: ens4
subnets:
- routes: []
type: dhcp4
type: physical
routes: []
use_ipv6: false
_version: 1
use_ipv6: false
...
Read input format 'network_data.json' from 'network-data.json'.
Wrote output format 'netplan' to 'test/'
2020-10-15 15:09:17,805 - util.py[DEBUG]: Writing to
/root/test/etc/netplan/50-cloud-init.yaml - wb: [644] 503 bytes
2020-10-15 15:09:17,806 - netplan.py[DEBUG]: netplan generate postcmd disabled
2020-10-15 15:09:17,806 - netplan.py[DEBUG]: netplan net_setup_link postcmd
disabled
2020-10-15 15:09:17,808 - util.py[DEBUG]: Reading from /proc/uptime
(quiet=False)
2020-10-15 15:09:17,808 - util.py[DEBUG]: Read 14 bytes from /proc/uptime
2020-10-15 15:09:17,808 - util.py[DEBUG]: cloud-init mode 'net-convert' took
0.011 seconds (0.01)
root@b1:~# cat test/etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: fa:16:3e:a3:34:78
mtu: 8950
set-name: ens4
## FOCAL ##
% lxc launch ubuntu-daily:focal f1
% lxc exec f1 bash
root@f1:~# lsb_release -rd
Description: Ubuntu 20.04.1 LTS
Release: 20.04
root@f1:~# dpkg --list | egrep "(cloud-init|netplan)"
ii cloud-init 20.3-2-g371b392c-0ubuntu1~20.04.1 all
initialization and customization tool for cloud instances
ii cloud-initramfs-copymods 0.45ubuntu1 all
copy initramfs modules into root filesystem for later use
ii cloud-initramfs-dyn-netconf 0.45ubuntu1 all
write a network interface file in /run for BOOTIF
ii libnetplan0:amd64 0.99-0ubuntu3~20.04.2 amd64
YAML network configuration abstraction runtime library
ii netplan.io 0.99-0ubuntu3~20.04.2 amd64
YAML network configuration abstraction for various backends
root@f1:~# cat /etc/cloud/build.info
build_name: server
serial: 20201014
root@f1:~# cat network-data.json
{"links": [{"id": "tapc352887e-0f", "vif_id":
"c352887e-0fff-481b-af47-7df9f7c2ff05", "type": "ovs", "mtu": 8950,
"ethernet_mac_address": "fa:16:3e:a3:34:78"}], "networks": [{"id": "network0",
"type": "ipv4_dhcp", "link": "tapc352887e-0f", "network_id":
"f8123ceb-e29d-4f4a-b200-6fb3bf3984ba"}], "services": []}
root@f1:~# cloud-init devel net-convert --network-data network-data.json -k
network_data.json -m "ens4,fa:16:3e:a3:34:78" -d test -D ubuntu --debug -O
netplan
2020-10-15 15:12:57,900 - util.py[DEBUG]: Reading from /proc/uptime
(quiet=False)
2020-10-15 15:12:57,901 - util.py[DEBUG]: Read 13 bytes from /proc/uptime
2020-10-15 15:12:57,901 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/addr_assign_type (quiet=False)
2020-10-15 15:12:57,901 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/eth0/addr_assign_type
2020-10-15 15:12:57,901 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/uevent (quiet=False)
2020-10-15 15:12:57,901 - util.py[DEBUG]: Read 26 bytes from
/sys/class/net/eth0/uevent
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/address (quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Read 18 bytes from
/sys/class/net/eth0/address
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from
/sys/class/net/eth0/device/device (quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from
/sys/class/net/lo/addr_assign_type (quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/lo/addr_assign_type
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent
(quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Read 23 bytes from
/sys/class/net/lo/uevent
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from
/sys/class/net/lo/address (quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Read 18 bytes from
/sys/class/net/lo/address
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from
/sys/class/net/lo/device/device (quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from /sys/class/net/eth0/type
(quiet=False)
2020-10-15 15:12:57,902 - util.py[DEBUG]: Read 2 bytes from
/sys/class/net/eth0/type
2020-10-15 15:12:57,902 - util.py[DEBUG]: Reading from /sys/class/net/lo/type
(quiet=False)
2020-10-15 15:12:57,903 - util.py[DEBUG]: Read 4 bytes from
/sys/class/net/lo/type
Internal State
--- !!python/object:cloudinit.net.network_state.NetworkState
_has_default_route: null
_network_state:
config:
- mac_address: fa:16:3e:a3:34:78
mtu: 8950
name: ens4
subnets:
- type: dhcp4
type: physical
dns:
nameservers: []
search: []
interfaces:
ens4:
accept-ra: null
address: null
gateway: null
inet: inet
mac_address: fa:16:3e:a3:34:78
mode: manual
mtu: 8950
name: ens4
subnets:
- routes: []
type: dhcp4
type: physical
routes: []
use_ipv6: false
_version: 1
use_ipv6: false
...
Read input format 'network_data.json' from 'network-data.json'.
Wrote output format 'netplan' to 'test/'
2020-10-15 15:12:57,910 - util.py[DEBUG]: Writing to
/root/test/etc/netplan/50-cloud-init.yaml - wb: [644] 503 bytes
2020-10-15 15:12:57,910 - netplan.py[DEBUG]: netplan generate postcmd disabled
2020-10-15 15:12:57,910 - netplan.py[DEBUG]: netplan net_setup_link postcmd
disabled
2020-10-15 15:12:57,910 - util.py[DEBUG]: Reading from /proc/uptime
(quiet=False)
2020-10-15 15:12:57,911 - util.py[DEBUG]: Read 13 bytes from /proc/uptime
2020-10-15 15:12:57,911 - util.py[DEBUG]: cloud-init mode 'net-convert' took
0.011 seconds (0.01)
root@f1:~# cat test/etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: fa:16:3e:a3:34:78
mtu: 8950
set-name: ens4
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1899487
Title:
cloud-init hard codes MTU configuration at initial deploy time
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1899487/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs